他们是否可以使用API​​打开Goog​​le Ads链接中的视图?

时间:2019-03-28 22:17:15

标签: google-analytics

他们是否可以使用PHP中的API启用Google Analytics(分析)Google Ads链接中的视图?

以下是Analytics(分析)中的截屏视频:https://www.screencast.com/t/L96GMmgPj9

我正在使用的API:https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/webPropertyAdWordsLinks/insert

当前,我正在使用此API。它只会关联Google Ads帐号,而不能打开视图。

// Construct an Google Ads account object.
$adWordsAccount = new Google_Service_Analytics_AdWordsAccount();
$adWordsAccount->setCustomerId("123-456-7890");

// Construct the body of the request.
$adWordsLink = new Google_Service_Analytics_EntityAdWordsLink();
$adWordsLink->setName('Google Ads Link');
$adWordsLink->setAdWordsAccounts(array($adWordsAccount));

try {
   $analytics->management_webPropertyAdWordsLinks->insert('123456',
  'UA-123456-1', $adWordsLink);

  } catch (apiServiceException $e) {
    print 'There was an Analytics API service error '
     . $e->getCode() . ':' . $e->getMessage();

  } catch (apiException $e) {
     print 'There was a general API error '
      . $e->getCode() . ':' . $e->getMessage();
   }

0 个答案:

没有答案