Traffic estimator service: discrepancy between API and UI results

379 views
Skip to first unread message

João Pedro Lisboa

unread,
Jan 10, 2014, 3:15:21 PM1/10/14
to adwor...@googlegroups.com
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);
            }
        }
    }
}

Ray Tsang (AdWords API Team)

unread,
Jan 15, 2014, 6:39:26 PM1/15/14
to adwor...@googlegroups.com
Joao,

Could I trouble you to send me the full SOAP request/response log (with sensitive information removed) using the "Reply to Author" feature?
Secondly, for the same criteria, could I trouble you to also send me the result you get in the UI?

This will help me investigate this question

Thanks!

--
Ray Tsang (AdWords API Advisor)

Mark

unread,
Sep 8, 2015, 6:57:45 AM9/8/15
to AdWords API Forum
Hello All,

Should I get Results same as UI using TrafficEstimatorService, If yes,
How I can get Top Estimated results like clicks, impressions, cost etc..  which is set under daily forecast and there predictions
like 
Clicks
185 – 226


Is this value possible using API?

Also Is all platform (Mobile, Desktop, Tablets) supported using API?

I am asking this because using API I can get Keywords Estimates but not generic estimates shown at top under UI.

Thanks

Josh Radcliff (AdWords API Team)

unread,
Sep 8, 2015, 6:14:48 PM9/8/15
to AdWords API Forum
Hi,

If you haven't done so already, I'd recommend checking out our Estimating Traffic guide, which gives a nice overview of the service including how the various API options map to the Keyword Planner tool.

The response from a TrafficEstimatorService call will only contain estimates at the keyword level (KeywordEstimate), so it won't give you the headings you see in the user interface. However, you might be able to approximate those headings by looking at the min/max fields across all of the returned KeywordEstimate objects.

Regarding the platform breakdown in the user interface, that option is not available in the API.

Thanks,
Josh, AdWords API Team
Reply all
Reply to author
Forward
0 new messages