Get the number of clicks on each ad for the last hour

31 views
Skip to first unread message

ja...@safedatatech.com

unread,
May 11, 2015, 4:53:41 AM5/11/15
to adwor...@googlegroups.com
Hi. Can you tell me how to get the number of clicks on the specified ad, by using it's id. And how to get the number of clicks realized during the last hour?

Anthony Madrigal

unread,
May 11, 2015, 11:57:05 AM5/11/15
to adwor...@googlegroups.com, ja...@safedatatech.com
Hi Jason, 

You could use the Ad Performance Report. In your selector, make sure to select Clicks. Unfortunately, you will not be able to get the number of clicks for the last hour using this report type since the field HourOfDay is not included in there.

This link on data freshness will also help you out some more.

Regards,
Anthony, AdWords API Team

ja...@safedatatech.com

unread,
May 12, 2015, 8:45:07 AM5/12/15
to adwor...@googlegroups.com
Thank a lot for answer. I have already found the solution. Here is the source:

function DownloadAdPerformanceReport(AdWordsUser $user, $filePath,
    $reportFormat) {
  // Prepare a date range for the last week. Instead you can use 'LAST_7_DAYS'.
  $dateRange = sprintf('%d,%d',
      date('Ymd', strtotime('-1 hour')), date('Ymd', strtotime('now')));

  // Create report query.
  $reportQuery = 'SELECT Id, Clicks, Impressions FROM AD_PERFORMANCE_REPORT '
      . 'WHERE Status IN [ENABLED, PAUSED] DURING ' . $dateRange;

  // Set additional options.
  $options = array('version' => ADWORDS_VERSION);

  // Download report.
  $result=ReportUtils::DownloadReportWithAwql($reportQuery, $filePath, $user,
      $reportFormat, $options);

  return $result;
Reply all
Reply to author
Forward
0 new messages