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 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python