How to get clicks and impression of each product in Campaign?

460 views
Skip to first unread message

Kishor Mali

unread,
Mar 17, 2017, 2:59:09 AM3/17/17
to AdWords API Forum
Hello Sir,
I am trying to get clicks per products. I am using PHP lib for that. But I didn't get any example regarding Click Performance Report.

There are reports regarding Campaign Clicks but I want the clicks per product (and impressions per product). Also, currently my adwords are inactive, so I want to get the clicks data for past months (past 2-3 months, if possible then daterange).

I am getting the campaign data as follows:

Campaign with ID 723074127 and name 'Australia' was found.
Campaign with ID 740655004 and name 'Campaign #1' was found.
Campaign with ID 625737268 and name 'India' was found.
Campaign with ID 633973156 and name 'Pune' was found.
Campaign with ID 741036435 and name 'Turkey' was found.
Number of results found: 5

And I tried CriteriaReportWithSelector, but I am unable to get required set of data.

 If any help will be appreciated.

Thanks.

Peter Oliquino

unread,
Mar 17, 2017, 3:49:41 AM3/17/17
to AdWords API Forum
Hi Kishor,

If you wish to get the Clicks and Impressions per shopping campaign (CampaignId) at the product level (OfferId), then I would recommend that you generate the Shopping Performance Report instead.

Additionally, could you provide more information as to what you meant by "my adwords are inactive"? Setting custom date ranges is possible and you can refer to this section of our reporting basics guide for more information.

Best regards,
Peter
AdWords API Team

Kishor Mali

unread,
Mar 17, 2017, 5:50:39 AM3/17/17
to AdWords API Forum
Thanks for the quick reply.

Q. what you meant by "my adwords are inactive"?
Actually, my adwords were running before 3 months. But after some problem in my shopping cart flow, Google suspend the account. So adwords are not appearing in search (hence no clicks and no impresssion). So, to verify the clicks and impressions from API, I have to specify the Date Range.

Please look at the screenshot I attached to this reply.
Capture.JPG

Kishor Mali

unread,
Mar 17, 2017, 6:01:35 AM3/17/17
to AdWords API Forum
Also, there is no help available regarding this Class "Shopping Performance Report". I crawl all examples and classes from AdsApi folder. But I am unable to locate this thing. Can you please help?

Peter Oliquino

unread,
Mar 20, 2017, 2:05:12 AM3/20/17
to AdWords API Forum
Hi Kishor,

Please refer to this reporting example (that is also available in the client library) on how to generate the Shopping Performance Report. In the same example code, you may specify in the "$reportQuery" string the fields of the Shopping Performance Report that you wish to select and replace the CRITERIA_PERFORMANCE_REPORT with SHOPPING_PERFORMANCE_REPORT.

As for the suspension of your account, kindly reach out to the AdWords Compliance Team as this is already out of scope for our team.

Kishor Mali

unread,
Mar 20, 2017, 3:16:47 AM3/20/17
to AdWords API Forum
Thanks for the reply, Peter.

Yes, I formulate that thing. Now, I got the CSV file of clicks and impression stats.

I tested it for different ReportDefinitionDateRangeType 
1) TODAY
2) YESTERDAY
3) LAST_7_DAYS

Its very good. Thanks once again.

Kishor Mali

unread,
Mar 20, 2017, 5:59:00 AM3/20/17
to AdWords API Forum
Hello,

I want to access the report values and store into my database.
When I am downloading reports. I got CSV or XML to download.
I want the result in array or Standard Class Object format, so that I can access the values.

I crawl through the Report Examples, But unable to find the methods to get stats from the $reportDownloadResult object.
Is there any documentation for this?
I got 2-3 methods in ReportDownloadResultDelegate class.
1)  getStream()
2) getAsString()
3) saveToFile()

Is there anything like getAsArray() or getAsObject() or something?
Or I have to manipulate the value from String or XML?

Peter Oliquino

unread,
Mar 20, 2017, 7:02:34 AM3/20/17
to AdWords API Forum
Hi Kishor,

The getAsArray() and getAsObject() methods are currently not supported. What is available, however, is getting the report as a String object via the getAsString() method. 

Thanks and regards,
Peter
AdWords API Team

Kishor Mali

unread,
Mar 20, 2017, 8:15:54 AM3/20/17
to AdWords API Forum
Thanks Peter.

I used DownloadFormat::XML and then convert the data to SimpleXMLElement. And then fetch the values.

$result = simplexml_load_string($reportDownloadResult->getAsString());


Reply all
Reply to author
Forward
0 new messages