Posts tagged with google-ads-api

Today, our google ads rejected due to macilious software issue. we have investgated this problem in details. we have checked the follow at our end:

  • we have check thorughly all website code
  • we have already scan our website using "malware scanner"
  • we have checked the website maleware scanner for virus total.
  • we have checked our database
  • the time-stamp of all pages are not change in recent time

BUT! occasionally a pop-up appears at the bottom of the webpage. the screenshot is attached to this message. https://exactautoglass.ca/[![enter image description here](https://i.sstatic.net/86TgZ.png)](https://i.sstatic.net/86TgZ.png)

i have tried eveything to run my google ads but it always rejected due to the "Malicious Software". I am looking for the solution!!

Any help would be appreciated. thanks

I'm using Google Ads API v11 to upload conversions and adjust conversions. I send hundreds of conversions each day and want to start sending batch requests instead.

I've followed Google's documentation and I upload/ adjust conversions exactly the way they stated. https://developers.google.com/google-ads/api/docs/conversions/upload-clicks https://developers.google.com/google-ads/api/docs/conversions/upload-adjustments

I could not find any good explanation or example on how to send batch requests: https://developers.google.com/google-ads/api/reference/rpc/v11/BatchJobService

Below is my code, an example of how I adjust hundreds of conversions. An explanation of how to do so with batch requests would be very appreciated.

# Adjust the conversion value of an existing conversion, via Google Ads API def adjust_offline_conversion(client,     customer_id,     conversion_action_id,     gclid,     conversion_date_time,     adjustment_date_time,     restatement_value,     adjustment_type='RESTATEMENT'):     # Check that gclid is valid string else exit the function     if type(gclid) is not str:         return None     # Check if datetime or string, if string make as datetime     if type(conversion_date_time) is str:         conversion_date_time = datetime.strptime(conversion_date_time, '%Y-%m-%d %H:%M:%S')     # Add 1 day forward to conversion time to avoid this error (as explained by Google: "The Offline Conversion cannot happen before the ad click. Add 1-2 days to your conversion time in your upload, or check that the time zone is properly set.")     to_datetime_plus_one = conversion_date_time + timedelta(days=1)     # If time is bigger than now, set as now (it will be enough to avoid the original google error, but to avoid a new error since google does not support future dates that are bigger than now)     to_datetime_plus_one = to_datetime_plus_one if to_datetime_plus_one < datetime.utcnow() else datetime.utcnow()     # We must convert datetime back to string + add time zone suffix (+00:00 or -00:00 this is utc) **in order to work with google ads api**     adjusted_string_date = to_datetime_plus_one.strftime('%Y-%m-%d %H:%M:%S') + "+00:00"     conversion_adjustment_type_enum = client.enums.ConversionAdjustmentTypeEnum     # Determine the adjustment type.     conversion_adjustment_type = conversion_adjustment_type_enum[adjustment_type].value     # Associates conversion adjustments with the existing conversion action.     # The GCLID should have been uploaded before with a conversion     conversion_adjustment = client.get_type("ConversionAdjustment")     conversion_action_service = client.get_service("ConversionActionService")     conversion_adjustment.conversion_action = (         conversion_action_service.conversion_action_path(             customer_id, conversion_action_id         )     )     conversion_adjustment.adjustment_type = conversion_adjustment_type     conversion_adjustment.adjustment_date_time = adjustment_date_time.strftime('%Y-%m-%d %H:%M:%S') + "+00:00"     # Set the Gclid Date     conversion_adjustment.gclid_date_time_pair.gclid = gclid     conversion_adjustment.gclid_date_time_pair.conversion_date_time = adjusted_string_date     # Sets adjusted value for adjustment type RESTATEMENT.     if conversion_adjustment_type == conversion_adjustment_type_enum.RESTATEMENT.value:         conversion_adjustment.restatement_value.adjusted_value = float(restatement_value)     conversion_adjustment_upload_service = client.get_service("ConversionAdjustmentUploadService")     request = client.get_type("UploadConversionAdjustmentsRequest")     request.customer_id = customer_id     request.conversion_adjustments = [conversion_adjustment]     request.partial_failure = True     response = (         conversion_adjustment_upload_service.upload_conversion_adjustments(             request=request,         )     )     conversion_adjustment_result = response.results[0]     print(         f"Uploaded conversion that occurred at "         f'"{conversion_adjustment_result.adjustment_date_time}" '         f"from Gclid "         f'"{conversion_adjustment_result.gclid_date_time_pair.gclid}"'         f' to "{conversion_adjustment_result.conversion_action}"'     ) # Iterate every row (subscriber) and call the "adjust conversion" function for it df.apply(lambda row: adjust_offline_conversion(client=client                                                    , customer_id=customer_id                                                    , conversion_action_id='xxxxxxx'                                                    , gclid=row['click_id']                                                    , conversion_date_time=row['subscription_time']                                                    , adjustment_date_time=datetime.utcnow()                                                    , restatement_value=row['revenue'])                                                    , axis=1) 

There are no matching costs between Google Ads Preview Data Transfer's tables - ads_GeoStats and ads_CampaignStats.

I'm interested in getting matched locations cost report for our world campaigns and I used ads_GeoStats table for that but when I check the value of metrics_cost_micros in ads_GeoStats, it shows that it is less than the value of metrics_cost_micros in ads_CampaignStats or Google Ads console.

Steps to reproduce:

select sum(metrics_cost_micros/1000000) from a.google_ads_preview.ads_CampaignStats_* where campaign_id = 123 and _DATA_DATE ='YYYY-MM-DD'

select sum(metrics_cost_micros/1000000) from a.google_ads_preview.ads_GeoStats_* where campaign_id =123 and _DATA_DATE = 'YYYY-MM-DD'

Any help in understanding why this gap exists?

Thanks, Roy

Expect the same costs from the google ads console and ads_GeoStats table.

Does anybody have some sample code that shows how to get the daily, total billed cost (across all campaigns) of a google ads account?

I have been looking for a sample for a while but could not find where you can get the total cost/billed cost for the day (or for a certain period of time).

I am doing this in Js but a sample in any language is okay. I would like to send this data to an airtable base, so if you have any suggestions on how that can be done too, that would be great!

Thanks in advance!