Estimate keyword traffic volume

409 views
Skip to first unread message

Iam_mine

unread,
Feb 8, 2017, 4:55:06 PM2/8/17
to AdWords API Forum
I wrote a script that generate keyword through a loop in php.
For each keyword I would like to pull traffic volume, what will be the best way to do that?

Shwetha Vastrad (AdWords API Team)

unread,
Feb 8, 2017, 5:27:10 PM2/8/17
to AdWords API Forum
Hi, 

You need to use TargetingIdeaService and TrafficEstimatorService to retrieve statistics and traffic estimates. The TargetingIdeaService can be used to retrieve new keyword ideas and search volume and data trends for existing keyword ideas. The TrafficEstimatorService, on the other hand, provides traffic estimates for existing or proposed campaigns, ad groups and keywords.  The GetKeywordIdeas and the EstimateKeywordTraffic PHP examples demonstrate how to use TargetingIdeaService and TrafficEstimatorService respectively. 

Regards,
Shwetha, AdWords API Team.

Iam_mine

unread,
Feb 8, 2017, 11:38:56 PM2/8/17
to AdWords API Forum
Regarding the TrafficEstimatorService how can I use it within an existing code that I wrote?
What I need to include and how I can put a variable within the set text e.g. $keyword->setText('');
and how can it be executed?

Shwetha Vastrad (AdWords API Team)

unread,
Feb 9, 2017, 12:35:08 PM2/9/17
to AdWords API Forum
Hi, 

You can pass a variable to the setText() method as shown in this example. You need to include at least one CampaignEstimateRequest in the TrafficEstimatorSelector with child AdGroupEstimateRequest and set the keywordEstimateRequests to contain the keywords. Once you have constructed the selector, you need to invoke the TrafficEstimatorService.get() method to execute the request. 

Regards,
Shwetha. AdWords API Team. 

Iam_mine

unread,
Feb 12, 2017, 3:29:22 PM2/12/17
to AdWords API Forum
Thanks I manage to set the text but how I can print/save the actual result.
After running the script through terminal i'm getting an empty line without any results.

Shwetha Vastrad (AdWords API Team)

unread,
Feb 13, 2017, 10:33:41 AM2/13/17
to AdWords API Forum
Hi,

This PHP example shows how to print the response from TrafficEstimatorService. If you still get an empty response, could you send over the SOAP request and response logs so I can take a look? This guide shows how to enable logging in the PHP client library. Please use Reply privately to author when responding.

Tal Haguel

unread,
Feb 17, 2017, 4:21:16 PM2/17/17
to adwordsapiad...@google.com, AdWords API Forum
I think I'm very close to the solution.
When creating:$keyword->setText(${"kw".$c});


I'm getting this error:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><
soap:Header><ResponseHeader
xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201609"
xmlns="https://adwords.google.com/api/adwords/o/v201609"><ns2:requestId
>000548c073e062180a56d48d7006270b</ns2:requestId><ns2:serviceName>Exper
imentDiversionService</ns2:serviceName><ns2:methodName>get</ns2:methodN
ame><ns2:operations>1</ns2:operations><ns2:responseTime>227</ns2:respon
seTime></ResponseHeader></soap:Header><soap:Body><soap:Fault><faultcode
>soap:Server</faultcode><faultstring>[RequiredError.REQUIRED @
selector.campaignEstimateRequests[0].adGroupEstimateRequests[0].keyword
EstimateRequests.keyword[0].text]</faultstring><detail><ApiExceptionFau
lt xmlns="https://adwords.google.com/api/adwords/o/v201609"
xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201609"><ns2:mess
age>[RequiredError.REQUIRED @
selector.campaignEstimateRequests[0].adGroupEstimateRequests[0].keyword
EstimateRequests.keyword[0].text]</ns2:message><ns2:ApplicationExceptio
n.Type>ApiException</ns2:ApplicationException.Type><ns2:errors
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="ns2:RequiredError"><ns2:fieldPath>selector.campaignEstimateRe
quests[0].adGroupEstimateRequests[0].keywordEstimateRequests.keyword[0]
.text</ns2:fieldPath><ns2:trigger></ns2:trigger><ns2:errorString>Requir
edError.REQUIRED</ns2:errorString><ns2:ApiError.Type>RequiredError</ns2
:ApiError.Type><ns2:reason>REQUIRED</ns2:reason></ns2:errors></ApiExcep
tionFault></detail></soap:Fault></soap:Body></soap:Envelope>
  
PHP Fatal error:  Uncaught
Google\AdsApi\AdWords\v201609\cm\ApiException: [RequiredError.REQUIRED
@
selector.campaignEstimateRequests[0].adGroupEstimateRequests[0].keyword
EstimateRequests.keyword[0].text] in
/home/xxx/workspace/adwords/vendor/googleads/googleads-php-
lib/src/Google/AdsApi/Common/Util/Reflection.php:39
Stack trace:
#0 /home/xxx/workspace/adwords/vendor/googleads/googleads-php-
lib/src/Google/AdsApi/Common/Util/Reflection.php(39): ReflectionClass-
>newInstanceArgs(Array)
#1 /home/xxx/workspace/adwords/vendor/googleads/googleads-php-
lib/src/Google/AdsApi/Common/AdsSoapClient.php(162):
Google\AdsApi\Common\Util\Reflection-
>createInstance('Google\\AdsApi\\A...', Array)
#2 /home/xxx/workspace/adwords/vendor/googleads/googleads-php-
lib/src/Google/AdsApi/Common/AdsSoapClient.php(126):
Google\AdsApi\Common\AdsSoapClient-
>parseApiExceptionFromSoapFault(Object(SoapFault))
#3 /home/xxx/workspace/adwords/vendor/googleads/googleads-php-
lib/src/Google/AdsApi/AdWords/v201609/o/TrafficEstimatorServic in
/home/xxx/workspace/adwords/vendor/googleads/googleads-php-
lib/src/Google/AdsApi/Common/Util/Reflection.php on line 39

Fatal error: Uncaught Google\AdsApi\AdWords\v201609\cm\ApiException:
[RequiredError.REQUIRED @
selector.campaignEstimateRequests[0].adGroupEstimateRequests[0].keyword
EstimateRequests.keyword[0].text] in
/home/xxx/workspace/adwords/vendor/googleads/googleads-php-
lib/src/Google/AdsApi/Common/Util/Reflection.php:39
Stack trace:
#0 /home/xxx/workspace/adwords/vendor/googleads/googleads-php-
lib/src/Google/AdsApi/Common/Util/Reflection.php(39): ReflectionClass-
>newInstanceArgs(Array)
#1 /home/xxx/workspace/adwords/vendor/googleads/googleads-php-
lib/src/Google/AdsApi/Common/AdsSoapClient.php(162):
Google\AdsApi\Common\Util\Reflection-
>createInstance('Google\\AdsApi\\A...', Array)
#2 /home/xxx/workspace/adwords/vendor/googleads/googleads-php-
lib/src/Google/AdsApi/Common/AdsSoapClient.php(126):
Google\AdsApi\Common\AdsSoapClient-
>parseApiExceptionFromSoapFault(Object(SoapFault))
#3 /home/xxx/workspace/adwords/vendor/googleads/googleads-php-
lib/src/Google/AdsApi/AdWords/v201609/o/TrafficEstimatorServic in
/home/xxx/workspace/adwords/vendor/googleads/googleads-php-
lib/src/Google/AdsApi/Common/Util/Reflection.php on line 39

On Mon, 2017-02-13 at 07:33 -0800, 'Shwetha Vastrad (AdWords API Team)'
> -- 
> -- 
> =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
> Also find us on our blog and Google+:
> https://googleadsdeveloper.blogspot.com/
> https://plus.google.com/+GoogleAdsDevelopers/posts
> =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
>  
> You received this message because you are subscribed to the Google
> Groups "AdWords API Forum" group.
> To post to this group, send email to adwor...@googlegroups.com
> To unsubscribe from this group, send email to
> adwords-api...@googlegroups.com
> 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 a topic in
> the Google Groups "AdWords API Forum" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/top
> ic/adwords-api/SAyH5fe0WVM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to a
> dwords-api+...@googlegroups.com.
> Visit this group at https://groups.google.com/group/adwords-api.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/adwords-api/4b8874c5-2690-4cf5-aae8-
> 55d7abbfce6d%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages