UploadOfflineConversion: How to send ConversionDateTime in click conversion

5,165 views
Skip to first unread message

Priya Sharma

unread,
Jun 23, 2021, 7:21:48 AM6/23/21
to AdWords API and Google Ads API Forum
I am using the date in UTC or ETC/GMT which was working fine with adwords API, but according to the new google Ads API I get the below error.

"The string date time's format should be yyyy-mm-dd hh:mm:ss+|-hh:m., at conversions[0].conversion_date_time"

In adwords API, I used as below: 
ConversionDateTime= ConversionTime.Value.ToString("yyyyMMdd HHmmss") + " Etc/GMT"

Please advise how to use this in google Ads API.

Pete Lavetsky (AdWords API Guru)

unread,
Jun 23, 2021, 1:16:27 PM6/23/21
to AdWords API and Google Ads API Forum
Hey Priya,

We ran into this too and here's how we do it in Java:

final String conversionDateTime = ZonedDateTime.of(conversion.getDateTime(), ZoneId.of("UTC")).format(DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss")) + "+00:00"; // ignore the totaly hack tacked on at the end https://bugs.openjdk.java.net/browse/JDK-8066806

Hope that helps
Pete

Priya Sharma

unread,
Jun 24, 2021, 2:34:11 AM6/24/21
to AdWords API and Google Ads API Forum
Thanks Pete!!

Google Ads API Forum Advisor

unread,
Jun 27, 2021, 11:20:16 PM6/27/21
to priya....@bold.com, adwor...@googlegroups.com
Hi,

Adding the guide on how to upload your click conversions using the Google Ads API :

"The conversion_date_time must have a timezone specified, and the format is as yyyy-mm-dd hh:mm:ss+|-hh:mm, for example, 2019-01-01 12:32:45-08:00. The timezone can be for any valid value: it does not have to match the account's timezone."

I hope this helps. Should you encounter issues, you may provide the complete request and response logs, with the request-id. If you haven't yet, logging can be enabled by navigating to the Client libraries > Your client library (ex. Java) > Logging documentation, which you can access from this link.

You may then send the requested information via the Reply privately to author option. If this option is not available, you may send the details directly to our googleadsa...@google.com alias instead.

Best regards,

Google Logo
Peter Laurence Napa Oliquino
Google Ads API Team
 

 

ref:_00D1U1174p._5004Q2Iy1K6:ref

Ajit Trivedi

unread,
Apr 18, 2022, 1:34:49 AM4/18/22
to Google Ads API and AdWords API Forum
Hi,
What is the variable "conversion" in conversion.getDateTime().
Thanks


On Wednesday, June 23, 2021 at 10:46:27 PM UTC+5:30 Pete Lavetsky (AdWords API Guru) wrote:

Google Ads API Forum Advisor

unread,
Apr 18, 2022, 9:54:07 PM4/18/22
to ajit.triv...@gmail.com, adwor...@googlegroups.com

Hi Ajit,
 

Thanks for reaching out to the Google Ads API Support team.


With regards to this concern, to know more about "variable "conversion" in conversion.getDateTime()." in Google Ads API. You can check this documentation conversion_date_time and Upload ClickConversion for more information on this.
 

Let us know if you have further questions.


Regards,

Google Logo
Darwin
Google Ads API Team
 


ref:_00D1U1174p._5004Q2a4A3A:ref

Vogels

unread,
Jul 9, 2024, 12:59:53 PM7/9/24
to Google Ads API and AdWords API Forum
Hi,

I also encountered an issue with conversionDateTime in the customers.uploadClickConversions call: https://developers.google.com/google-ads/api/reference/rpc/v17/ClickConversion?hl=en#conversion_date_time

The documentation states the value should be: The date time at which the conversion occurred. Must be after the click time. The timezone must be specified. The format is "yyyy-mm-dd hh:mm:ss+|-hh:mm", for example, "2019-01-01 12:32:45-08:00".

I'm assuming the API expects a UTC date time (i.e. Date() or Date.now() in JavaScript, transformed to the string format) followed by a timezone offset suffix (e.g. '+02:00' for 'GTM+2'),  but the documentation does not explicitly state this. I tried sending a conversion with a conversionDateTime in UTC time including a '+02:00' timezone offset suffix (for Central European Summer Time) but received the following error:

"The imported event has a conversion_date_time that precedes the click. Make sure your conversion_date_time is correct and try again.",

Also, in what time does Google Ads store the click itself? Does it use the same format as conversionDateTime?

Thanks!

Google Ads API Forum Advisor

unread,
Jul 9, 2024, 4:01:34 PM7/9/24
to vogelsonli...@gmail.com, adwor...@googlegroups.com
Hi,

I would like to inform you that Google Ads does not store the click Ids. I would recommend that you refer to your tagging setup to know the timezone for the stored GCLIDS. I would also recommend that you try to upload with the conversions with the same timezone that you find with the stored GCLID.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02a4A3A:ref" (ADR-00102574)

Thanks,

 
Google Logo Google Ads API Team

Register for the upcoming workshop: Performance Max and the Google Ads API!
 


Vogels

unread,
Jul 11, 2024, 6:00:33 AM7/11/24
to Google Ads API and AdWords API Forum
Ok, two questions:

- How does Google Ads determine the time between a click (GCLID) and the conversionDateTime value (if it does not store GCLID like you mentioned) to generate a (partial failure) error like CONVERSION_PRECEDES_EVENT? What timestamp (or datetime value) does it use and does it use a timezone offset?
- I uploaded a conversionDateTime of "2024-07-09 12:30:47+02:00" (UTC time with GMT+2 timezone suffix) that resulted in a CONVERSION_PRECEDES_EVENT partial failure error. The click that resulted in this particular conversion happened approximately 33 minutes prior to the conversion at this datetime. Why did I get this error? If the conversionDateTime value was incorrect, what is the expected value? Either UTC time with a timezone suffix or local time (e.g. "2024-07-09 12:30:47" becomes "2024-07-09 14:30:47+02:00" due to the the +2 hour offset) with a timezone offset of '+00:00' or +'02:00'?

Google Ads API Forum Advisor

unread,
Jul 11, 2024, 12:20:04 PM7/11/24
to vogelsonli...@gmail.com, adwor...@googlegroups.com
Hi,

Please find the answers for your questions below:

1. Google Ads uses the Google Click Identifier (GCLID) to track clicks and associate them with conversions. While Google Ads does not store the GCLID itself in your account data, it uses the associated metadata, including timestamps, to determine when the click occurred.

2. Google Ads records the exact timestamp when a click occurs. This timestamp is in UTC (Coordinated Universal Time). When you upload a conversion, you provide a conversionDateTime. This value can be in any timezone, but it must be formatted correctly and should ideally be in UTC for consistency. If you provide a timezone offset, Google Ads will convert the conversionDateTime to UTC before comparing it with the click timestamp. If your conversion timestamp (2024-07-09 10:30:47+00:00) is correctly later than the click timestamp (2024-07-09 09:57:47+00:00), then there should be no CONVERSION_PRECEDES_EVENT error unless there was an issue with the timezone conversion or the recorded click timestamp. I would recommend you to kindly refer to the ''conversion_date_time" guide for more detailed information. 

In order to investigate your issue further, kindly provide us with the complete API logs (request and response logs with request-id and request header) generated at your end to better assist you further. 

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java, .Net, PHP, Python, Ruby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

You can send the details via Reply privately to the author option, or direct private reply to this email.
Reply all
Reply to author
Forward
0 new messages