Posts tagged with google-ads-api

I may be doing it the wrong way but I want, at first, to extract keyword traffic information like I did with TrafficEstimationService in the (now deprecated) AdWords API. My code looks like this (with some edits here and there):

# [... some initialization (clients, service accounts, etc.) bits here] # fetch an instance of the Google Ads client gc = GoogleAdsClient.load_from_storage(gads_credentials_file, version="v10") # fetch an instance of the Google Ads service gs = gc.get_service("GoogleAdsService") # fetch an instance of the Geo Target Constant service gtcs = gc.get_service("GeoTargetConstantService").geo_target_constant_path # fetch an instance of the keyword plan idea service ks = gc.get_service("KeywordPlanIdeaService") # build the initial search request rq = gc.get_type("GenerateKeywordIdeasRequest") rq.customer_id = gads_account_id.replace("-", '') rq.geo_target_constants = [gtcs(get_location_id(gads_country))] rq.keyword_plan_network = (gc.enums.KeywordPlanNetworkEnum.GOOGLE_SEARCH_AND_PARTNERS) rq.language = gs.language_constant_path(get_language_id(gads_language)) rq.keyword_annotation = gc.enums.KeywordPlanKeywordAnnotationEnum if len(gads_keywords) > 0:     rq.keyword_seed.keywords.extend(gads_keywords) # generate keyword ideas keyword_ideas = ks.generate_keyword_ideas(request=rq) rows = [] for idea in keyword_ideas:     rows.append({         "date": r,         "text": idea.text,         "competition_value": idea.keyword_idea_metrics.competition.name,         "avg_monthly_searches": idea.keyword_idea_metrics.avg_monthly_searches     }) 

So far, so good. I can specify location and language and (of course) they keywords to look for. At the end of this request, I have something like this (just printing the first list item):

{'date': '2022-08-09', 'text': 'zapatos', 'competition_value': 'MEDIUM', 'avg_monthly_searches': 301000} 

The problem I have is I have been requested to ensure the match type is EXACT but looking at both the documentation and the source code for KeywordPlanIdeaService there is no trace of this parameter. That's why I assume I'm doing it wrong (or maybe I'm lacking something here). In any case, I'm a bit lost.

Can you tell me how can I specify this (if it can be done) or an alternate way to accomplish this?

I am trying to upload a conversion using REST API, as I am writing code in rust hence no library is there for that, I am struggling to get the correct response, as, I am not aware of what should the proper request body, and there is no sample payload for a request given by google, the help available is not sufficient to make my request thru.

URL https://googleads.googleapis.com/v10/customers/948-412-1501:uploadClickConversions

Header: 'developer-token': 'X8ec', Authorization: 'Bearer ya29', 'Content-Type': 'application/json'

Post Body { "gclid": "0988098080", "conversionAction": "Submit lead form", "conversionDateTime": "2022-08-06 12:32:45-08:00", "conversionValue": "10", "currencyCode": "10", "orderId": "11111" }

Response

{ "error": { "code": 400, "message": "Invalid JSON payload received. Unknown name "gclid": Cannot find field.\nInvalid JSON payload received. Unknown name "conversionAction": Cannot find field.\nInvalid JSON payload received. Unknown name "conversionDateTime": Cannot find field.\nInvalid JSON payload received. Unknown name "conversionValue": Cannot find field.\nInvalid JSON payload received. Unknown name "currencyCode": Cannot find field.\nInvalid JSON payload received. Unknown name "orderId": Cannot find field.", "status": "INVALID_ARGUMENT", "details": [ { "@type": "type.googleapis.com/google.rpc.BadRequest", "fieldViolations": [ { "description": "Invalid JSON payload received. Unknown name "gclid": Cannot find field." }, { "description": "Invalid JSON payload received. Unknown name "conversionAction": Cannot find field." }, { "description": "Invalid JSON payload received. Unknown name "conversionDateTime": Cannot find field." }, { "description": "Invalid JSON payload received. Unknown name "conversionValue": Cannot find field." }, { "description": "Invalid JSON payload received. Unknown name "currencyCode": Cannot find field." }, { "description": "Invalid JSON payload received. Unknown name "orderId": Cannot find field." } ] } ] } }

I'm trying to upload around 8 million users to Google Ads using Google Ads API (OfflineUserDataJob).

On UI, I see that my upload is successful with match rate (91%~100%). It took around 1-2 hours for the OfflineUserDataJob status change from RUNNING --> SUCCESS

But I can't see the Segment size change on UI (Audience Manager tab)

I read document that is https://developers.google.com/google-ads/api/docs/remarketing/audience-types/customer-match?hl=en#customer_match_considerations . I understand that it may take up to 24hours, but I can't seem to find the status "In Progress" on Google Ads UI

Is 24hours apply between status SUCCESS and update Segment size on UI?

I'm trying to use AWS AppFlow to ingest Google Ads supported objects to AWS S3. Though i have successfully created connections using GoogleAds Connector I'm unable to ingest the data to S3.

Steps followed from AWS console:
Step 1: Name of the flow was provided.
Step 2: Configure Source and Destination. Recently created Google Ads Connection was chosen for source and AWS S3 bucket for destination. Flow Trigger is set to ‘Run on Demand’ (Step2 Figure )
Step 3: Map Data Fields: This page throws the error. (Step3 Figure)

I have followed all the steps as it is from AWS Doc
Error Message:

An error occurred while retrieving fields Error while communicating to connector: The request failed because the service Source Customconnector returned the following error: Details: GoogleAds metadata response can not be null or empty, ErrorCode: ServerError.


I also tried changing the mapping method and chose to upload a mapping csv file but even it failed with the error "Couldn't parse rows from the file."


Alternatively when trying to retrieve the campaign object from the python script it returns the desired output.

Any leads around this will be appreciated.
(Also this is my first post on stack overflow :P)

How do I report conversion from gtag on server side back to google ads?

My current setup is that I report events from gtag back to google analytics 4 using unique userId (generated in my database and it's unique for each user)

    let data = {         client_id: this.getDeviceId(),         user_id: this.userId,         events: [{             name: eventName,             params: props,         }]     }     ... then send it as payload to the tracking url to the ga4 tracking url:     https://www.google-analytics.com/mp/collect?measurement_id=...&api_secret=... 

Now I launched google ads and want to report purchase and renewals as conversion.

So I imported my target event from GA4 to google ads as an offline event.

But to my understanding, in order to properly link the user back to google ads, I also need to pass gclid in gtag when I report the event/conversion, but how to do that?

Should I just add gclid as property in data? Is it documented anywhere?

I was using the below doc link in order to setup gtag tracking on the server: https://developers.google.com/analytics/devguides/collection/protocol/ga4/user-properties?client_type=gtag