Hi all,
I am using the most recent version of Adwords API (v201309) and I am having
problems with Traffic Estimator service.
When I perform the a query through API, results don't match with UI.
For example, I want to do a query to find the estimated traffic for the
keyword "sapato masculino" (men's shoes), restricted to Brazil and
Portuguese language. I do it for a set of bids, in order to find out the
best initial bit to set up on my keyword settigns. The problem is that when
I do the same query through Adwords UI, it results in different numbers.
API's results are always more optimist. When I set the bit to a high value,
such as R$ 999999,99, the number of impressions are the same for the both
results. But the maximum values for average position, cpc and CTR (and,
consequently, number of clicks) is never the same --> API's results are
better then UI's. Of course, I am using the same account for the both of
methods...
Can somebody helps me please?
Following is my source code (in C#). I perform the test for values from
R$0,01 to R$0,10. Only the maximum number of impressions matches with UI's
results:
===========================================================================
using Google.Api.Ads.AdWords.Lib;
using Google.Api.Ads.AdWords.v201309;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace CPCOptimizer
{
class Program
{
public static void Main(string[] args)
{
Program codeExample = new Program();
try
{
string kw = "sapato masculino";
codeExample.TrafficEstimator(new AdWordsUser(), 10 *
1000000, kw, KeywordMatchType.BROAD);
codeExample.TrafficEstimator(new AdWordsUser(), 9 *
1000000, kw, KeywordMatchType.BROAD);
codeExample.TrafficEstimator(new AdWordsUser(), 8 *
1000000, kw, KeywordMatchType.BROAD);
codeExample.TrafficEstimator(new AdWordsUser(), 7 *
1000000, kw, KeywordMatchType.BROAD);
codeExample.TrafficEstimator(new AdWordsUser(), 6 *
1000000, kw, KeywordMatchType.BROAD);
codeExample.TrafficEstimator(new AdWordsUser(), 5 *
1000000, kw, KeywordMatchType.BROAD);
codeExample.TrafficEstimator(new AdWordsUser(), 4 *
1000000, kw, KeywordMatchType.BROAD);
codeExample.TrafficEstimator(new AdWordsUser(), 3 *
1000000, kw, KeywordMatchType.BROAD);
codeExample.TrafficEstimator(new AdWordsUser(), 2 *
1000000, kw, KeywordMatchType.BROAD);
codeExample.TrafficEstimator(new AdWordsUser(), 1 *
1000000, kw, KeywordMatchType.BROAD);
Console.Read();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
/// <summary>
/// Runs the code example.
/// </summary>
/// <param name="user">The AdWords user.</param>
public void TrafficEstimator(AdWordsUser user, long maxCpc, string
kw, KeywordMatchType matchType)
{
// Get the TrafficEstimatorService.
TrafficEstimatorService trafficEstimatorService =
(TrafficEstimatorService)user.GetService(
AdWordsService.v201309.TrafficEstimatorService);
// Create keywords. Up to 2000 keywords can be passed in a
single request.
Keyword keyword1 = new Keyword();
keyword1.text = kw;
keyword1.matchType = matchType;
// Create a keyword estimate request for each keyword.
List<KeywordEstimateRequest> keywordEstimateRequests = new
List<KeywordEstimateRequest>();
keywordEstimateRequests.Add(new KeywordEstimateRequest() {
keyword = keyword1 });
// Create negative keywords.
// Create ad group estimate requests.
AdGroupEstimateRequest adGroupEstimateRequest = new
AdGroupEstimateRequest();
adGroupEstimateRequest.keywordEstimateRequests =
keywordEstimateRequests.ToArray();
adGroupEstimateRequest.maxCpc = new Money();
adGroupEstimateRequest.maxCpc.microAmount = maxCpc;
// Create campaign estimate requests.
CampaignEstimateRequest campaignEstimateRequest = new
CampaignEstimateRequest();
campaignEstimateRequest.adGroupEstimateRequests = new
AdGroupEstimateRequest[] { adGroupEstimateRequest };
//campaignEstimateRequest.networkSetting = new NetworkSetting()
//{
// targetContentNetwork = false,
// targetGoogleSearch = true,
// targetPartnerSearchNetwork = false,
// targetSearchNetwork = false
//};
// See
http://code.google.com/apis/adwords/docs/appendix/countrycodes.html
// for a detailed list of country codes.
Location countryCriterion = new Location();
countryCriterion.id = 2076; //Brazil
// See
http://code.google.com/apis/adwords/docs/appendix/languagecodes.html
// for a detailed list of language codes.
Language languageCriterion = new Language();
languageCriterion.id = 1014; //pt
campaignEstimateRequest.criteria = new Criterion[] {
countryCriterion, languageCriterion };
// Create the selector.
TrafficEstimatorSelector selector = new
TrafficEstimatorSelector();
selector.campaignEstimateRequests = new
CampaignEstimateRequest[] { campaignEstimateRequest };
try
{
// Get traffic estimates.
TrafficEstimatorResult result =
trafficEstimatorService.get(selector);
// Display traffic estimates.
if (result != null && result.campaignEstimates != null &&
result.campaignEstimates.Length > 0)
{
CampaignEstimate campaignEstimate =
result.campaignEstimates[0];
if (campaignEstimate.adGroupEstimates != null &&
campaignEstimate.adGroupEstimates.Length > 0)
{
AdGroupEstimate adGroupEstimate =
campaignEstimate.adGroupEstimates[0];
if (adGroupEstimate.keywordEstimates != null)
{
for (int i = 0; i <
adGroupEstimate.keywordEstimates.Length; i++)
{
if (keywordEstimateRequests[i].isNegative)
{
continue;
}
Keyword keyword =
keywordEstimateRequests[i].keyword;
KeywordEstimate keywordEstimate =
adGroupEstimate.keywordEstimates[i];
double mcpc = ((double)maxCpc) / 100000000d;
double cpc =
((double)(keywordEstimate.min.averageCpc.microAmount +
keywordEstimate.max.averageCpc.microAmount)) / 200000000d;
float clicks =
(keywordEstimate.min.clicksPerDay + keywordEstimate.max.clicksPerDay) / 2;
float impressions =
(keywordEstimate.min.impressionsPerDay +
keywordEstimate.max.impressionsPerDay) / 2;
float ctr =
((keywordEstimate.min.clicksPerDay + keywordEstimate.max.clicksPerDay) /
(keywordEstimate.min.impressionsPerDay +
keywordEstimate.max.impressionsPerDay)) * 100.0f;
double cost =
((double)(keywordEstimate.min.totalCost.microAmount +
keywordEstimate.max.totalCost.microAmount)) / 200000000d;
double pos =
(keywordEstimate.min.averagePosition + keywordEstimate.max.averagePosition)
/ 2;
Console.WriteLine("{0:0.00}:\t\t{1} | {2} |
{3:0.00} | {4:0.00}", mcpc, Math.Round(clicks), Math.Round(impressions),pos
, (cost/clicks));
}
}
}
}
else
{
Console.WriteLine("No traffic estimates were
returned.\n");
}
}
catch (Exception ex)
{
throw new System.ApplicationException("Failed to retrieve
traffic estimates.", ex);
}
}
}
}
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.