dongxing2710 2014-09-12 19:04
浏览 22
已采纳

从Google AnalyticsAPI中的当前视图中检索adWordsCampaignID

Using only the Analytics API, I've discovered you can pull Adwords data by specifying the adwordsCampaignID However, I cannot figure out how to retrieve the adwordsCampaignID of the current view, or alternately, to get it by filtering on some property of the current view.

I cycle through several dozen domains and need to pull the adwordsCampaignID of each view & insert it into the following function. a

function getAdWords(&$analytics, $profileId) {
   return $analytics->data_ga->get(
       'ga:' . $profileId,
       '2014-07-01',
       '2014-09-09',
      'ga:adClicks,ga:CTR,ga:impressions', 
      array('dimensions' => 'ga:adwordsCampaignID,ga:adwordsAdGroupID,ga:adGroup,ga:keyword','sort' =>
            '-ga:impressions','filters' => 'ga:adwordsCampaignID=='.'8486***','max-results' => '50')

       );

}

Something along the lines of $results = getAdwordsCampaignID($analytics);
  • 写回答

1条回答 默认 最新

  • dskyx46424 2014-09-19 20:49
    关注

    Turns you can pull AdWords data using only the Google Analytics API (as long as your GA account is joined to the AdWords account).

    Can be done like this:

    function getAdWords(&$analytics, $profileId) {
       return $analytics->data_ga->get(
           'ga:' . $profileId,
           '2014-07-01',
           '2014-09-09',
          'ga:adClicks,ga:CTR,ga:impressions', 
          array('dimensions' => 'ga:adwordsCampaignID,ga:adwordsAdGroupID,ga:adGroup,ga:keyword','sort' =>
                '-ga:impressions','filters' => 'ga:adwordsCampaignID=='.'84*690*','max-results' => '50')
    
           );
    
    }
    

    However, there are limitations. You must have the adWordsCampaignID. As far as I can tell, there is no way to retrieve the adWordsCampaignID of a view using only the GA API. You must join the data between the AdWords + GA APIs using the CustomerID variable.

    The Google API Query Explorer is a great help if you are working to implement this.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥15 Python3.5 相关代码写作
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里