Posts under category Google

With the script below, I find a number of keywords with AdWordsApp.keywords() based on some parameters. Once these words are found, they must be paused.

My question is the following: How can I use the same list of ExactKeywords, that I have already found, to activate the same keyword in another campaign with a different name than CampaignName?


   var Exact_CampaignName = "CampaignName_1";          function main() {       // Getting list of keywords with cliks       var kw_Conv_Exact = AdWordsApp.keywords()         .withCondition("Click >= 50")         .withCondition("Status = ENABLED")         .withCondition(Exact_CampaignName)         .get();                      // Get Keywords from Campaigns_1       var ExactKeywords = [];       while (kw_Conv_Exact.hasNext()) {         var kw_exact = kw_Conv_Exact.next();         ExactKeywords.push(kw_exact);                       // Pause exaxt keywords.         for(var i in ExactKeywords) {           ExactKeywords[i].pause();         }   //But how do I enable the same keywords from var ExactKeywords = [] but in another campaign_2???      } 


Thanks in advance

I have a Ghost newsletter that has a premium subscription set up with Stripe.

Basically, people go to the /subscribe page, choose a price, get redirected to Stripe, and then upon success, get redirected to the main page /, where the url will now have this appended:

?stripe_portal=success

I want to track Google Adwords conversions when the purchase is made.

I don't know how to do that, as conversion code on the main page would also count normal visits.

I am trying to fetch campaigns' reports from Google Ads API. But, getting an error when trying to fetch data with MCC:

Code:

  import sys,os   from google.ads.google_ads.client import GoogleAdsClient   from google.ads.google_ads.errors import GoogleAdsException   def get_data(client, customer_id):     ga_service = client.get_service("GoogleAdsService", version="v6")     query = """         SELECT           campaign.name,           campaign.status,           segments.device,           metrics.impressions,           metrics.clicks,           metrics.ctr,           metrics.average_cpc,           metrics.cost_micros         FROM campaign         WHERE segments.date DURING LAST_30_DAYS         """     # Issues a search request using streaming.     response = ga_service.search_stream(customer_id, query=query)     try:         for batch in response:             for row in batch.results:                 print(                     row                 )     except GoogleAdsException as ex:         print(             f'Request with ID "{ex.request_id}" failed with status '             f'"{ex.error.code().name}" and includes the following errors:'         )         for error in ex.failure.errors:             print(f'\tError with message "{error.message}".')             if error.location:                 for field_path_element in error.location.field_path_elements:                     print(f"\t\tOn field: {field_path_element.field_name}")         sys.exit(1)     if __name__ == "__main__":         # get client object with oauth2         credentials = {'developer_token': "xxxxxxxxxxxxxxx",             'refresh_token': "xxxxxxxxxxxxxxxx",             'client_id': "xxxxxxxxxxxxxxx",             'client_secret': "xxxxxxxxxxxxxxxx"                        }         google_ads_client = GoogleAdsClient.load_from_dict(credentials)              get_data(google_ads_client, 'xxxxxxxxx') 

Wehn Running the code with MCC client ID:

get_data(google_ads_client, 'MANAGER(MCC)_CLIENT_ID') 

I'm Getting Error_1:

Request made: ClientCustomerId: xxxxxxxxx, Host: googleads.googleapis.com:443, Method: /google.ads.googleads.v6.services.GoogleAdsService/SearchStream, RequestId: xxxxxxxxxx, IsFault: True, FaultMessage: Metrics cannot be requested for a manager account. To retrieve metrics, issue separate requests against each client account under the manager account.

I assumed, the solution would be to set a different ClientCustomerId of the account itself, not MCC. So I did, and run the code again with the client id of the direct account, and, got another error:

Wehn Running the code with Account client ID:

get_data(google_ads_client, 'ACCOUNT_CLIENT_ID') 

I'm Getting Error_2:

Request made: ClientCustomerId: xxxxxxx, Host: googleads.googleapis.com:443, Method: /google.ads.googleads.v6.services.GoogleAdsService/SearchStream, RequestId: xxxxxxxxxx, IsFault: True, FaultMessage: User doesn't have permission to access customer. Note: If you're accessing a client customer, the manager's customer id must be set in the 'login-customer-id' header. See https://developers.google.com/google-ads/api/docs/concepts/call-structure#cid

That error essentially says to insert the manager's client id, which I already did and got error_1 (!).

What am I missing here?

I'm getting this error when running this code:

$googleAdsClient->getGoogleAdsServiceClient()->search($customerId, $query, $page_size); 

ERROR message: proto descriptor was previously loaded (included in multiple metadata bundles?): google/ads/googleads/v5/enums/policy_topic_evidence_destination_not_working_dns_error_type.proto

$googleAdsClient is an instance of \Google\Ads\GoogleAds\Lib\V5\GoogleAdsClient.

The getGoogleAdsServiceClient method comes from the ServiceClientFactoryTrait trait /Google/Ads/GoogleAds/Lib/V5/ServiceClientFactoryTrait.php

I'm running:

php 7.4.1 grpc module version => 1.34.0 protobuf version => 3.14.0 

Additional libs installed via composer:

google/grpc-gcp                       0.1.5      gRPC GCP library for channel management google/protobuf                       v3.13.0.1  proto library for PHP googleads/google-ads-php              v5.0.0     Google Ads API client for PHP grpc/grpc                             1.30.0     gRPC library for PHP 

I don't know enough about descriptors or the protobuf library to understand this error. It just started happening a couple days ago and I don't think we made any changes that would effect this. Any help/guidance would be much appreciated.

EDIT: forgot to link to SDK https://github.com/googleads/google-ads-php

EDIT: updated the following libs:

google/apiclient                     v2.9.1     Client library for Google APIs google/apiclient-services            v0.161.0   Client library for Google APIs google/auth                          v1.15.0    Google Auth Library for PHP google/common-protos                 1.3        Google API Common Protos for PHP google/gax                           1.7.0      Google API Core for PHP google/grpc-gcp                      0.1.5      gRPC GCP library for channel management google/protobuf                      v3.15.3    proto library for PHP googleads/google-ads-php             v7.0.0     Google Ads API client for PHP grpc/grpc                            1.35.0     gRPC library for PHP google/protobuf                      v3.15.3    proto library for PHP