• Priority: 0
  • Status: Closed
  • Theme: Alysum
  • Assigned To: Fred
  • Private: No
  • Open Date: 23.10.21, 13:19
  • Opened by: Serhiy Hantsev
  • Closed by: Anonymous Submitter
  • Closed on:
  • Reason: Not a bug

Ticket #22491 - AMP Google Ads Conversions Tracking

Dear Promokit assistance,

we are trying to track Google Ads conversions via Google Tag Manager and the Google Ads Conversion Tracking tag. We followed the following documentation:

https://developers.google.com/google-ads/amp/conversion-measurement

of which I quote:

“For accurate conversion measurement, ad clicks pass on a GCLID (”Google click identifier”) to your landing pages. The landing pages will store the GCLID in a cookie on your domain and the GCLID parameter is then included in conversion tags on your site. Read How Google Ads tracks website conversions for more details.”

“Since AMP landing pages are typically served from AMP cache domain, they cannot store the GCLID in a cookie on your domain. You need to set up tags on the AMP landing pages to pass the GCLID on outgoing links to your site pages via a query parameter in the URL. The tags on your site pages can then retrieve the GCLID from the query parameter and store the GCLID as a cookie on your domain.”

We have set the conversion linker both in the web container and in the amp container as per the documentation but the url query is lost when navigating in amp from one page to another.

The correct behavior should be:

Landing category page:

https://smanique.com/de/mobile/category/15-cinturini-apple-watch-serie-5-da-40mm-e-44mm?gclid=Tester123#xyz

Next product page:

https://smanique.com/de/mobile/product/621-classic-ace-quick-adjust-stainless-steel-band-apple-watch-38mm-40mm-41mm-and-42mm-44mm-45mm-strap?gclid=Tester123

But it actually happens that the url query gets lost:

Landing category page:

https://smanique.com/de/mobile/category/15-cinturini-apple-watch-serie-5-da-40mm-e-44mm?gclid=Tester123#xyz

Next product page:

https://smanique.com/de/mobile/product/621-classic-ace-quick-adjust-stainless-steel-band-apple-watch-38mm-40mm-41mm-and-42mm-44mm-45mm-strap

This leads to the non-tracking of conversions that occur through landing amp pages.

Among the vary tickets we found the site https://bigbagmarket.it/ in which the url query remains in the navigation between the various amp pages:

Landing category page:

https://bigbagmarket.it/mobile/category/6-big-bag-costruzione-e-cantiere?gclid=Tester123#xyz

Next product page:

https://bigbagmarket.it/mobile/product/364-Garden-bag-340-liter-and-up-to-1-tonnes-70X70X70?gclid=Tester123

Furthermore, the url query does not persist on your demo store:

Landing category page:

https://alysum5.promokit.eu/oldstyle/en/mobile/category/63-t-shirt?gclid=Tester123#xyz

Next product page:

https://alysum5.promokit.eu/oldstyle/en/mobile/product/4-printed-dress

Since the persistence of the url query between the various amp pages is a prerequisite for correctly tracking Google Ads conversions, could you kindly help us to achieve it?

I am attaching the conversion linker settings for both the amp and the web container.

I take this opportunity to wish you a good day and good work.

A thousand thanks.

Attachments:

GTM-AMP-Conversion-Linker.png (21.6 KiB)
GTM-WEB-Conversion-Linker.png (40.8 KiB)

Comments

Fred 24 Oct 2021, 22:48

Hi, Serhiy.
Such a long text.
As I understand, you need to add missed url parameter in product page, right?

Serhiy Hantsev 25 Oct 2021, 07:13

Good morning Fred, sorry if I dwelt. To track Google Ads campaigns correctly, the landing page query url must be passed to subsequent pages while the user is browsing on AMP. If a user lands on the page:

https://smanique.com/de/mobile/category/15-strap-apple-watch-serie-5-da-40mm-and-44mm?gclid=Tester123

The following url query must remain on the following pages:

?gclid=Tester123

As it happens on the site https://bigbagmarket.it/

This is the correct behavior:

https://monosnap.com/file/PAAfiW8fhKEKTyEJfsyJ6tUcfTYhgj

On our site, however, the query url is lost when you go to the following pages:

https://monosnap.com/file/P5ciHWhA1rdqOvK6MQ7DxFdiMYeP5a

A thousand thanks.

Serhiy Hantsev 25 Oct 2021, 07:20

This is necessary because in the desktop version of the site the GCLID is saved in a cookie and then read by the Google Ads conversion tag in the order confirmation page by the cookie. On AMP, on the other hand, since it does not use cookies, the GCLID must be passed via url query from page to page to the order confirmation page and then read by the Google Ads conversion tag from the url query instead of the cookie. Thanks.

Fred 26 Oct 2021, 16:39

Hi, Serhiy.
Sorry for the late reply, we are overbusy these days.
I need an information where those url queries comes from? Do you use some module for that?

Serhiy Hantsev 26 Oct 2021, 16:52

Don’t worry Fred, I understand you, thanks for the reply. When a user clicks on a Google Ad, Google adds a url query containing the Google Click ID (GCLID) to the landing page url. This GCLID is associated with the information of the user who clicked on the advertisement, the entry keyword, the entry link, etc. If the user browses from the desktop, the GCLID must appear only on the landing page, as already happens, as it will be saved in a cookie and when the user lands on the order confirmation page it will be read by the Google Ads Conversion tag which will take the CGLID from the cookie. If, on the other hand, the user navigates on AMP, since AMP does not support cookies, this GCLID must pass from one page to another via url query up to the order confirmation page and will be read by the Google Ads Conversion tag from the url query. I hope I was clear, thank you very much.

Serhiy Hantsev 26 Oct 2021, 17:06

In fact, the tracking of Google Ads conversions of users who buy on our site via desktop is done perfectly while the conversions made by users who surf on AMP are not tracked on Google Ads. This is because on AMP the GCLID is lost when a user moves from the landing page to the next page. So if the URL in an AMP page contains an url query, that url query must go from page to page when the user browses the site. As it was done on the site https://bigbagmarket.it/. Thanks again.

Fred 26 Oct 2021, 17:23

Ok, I see. So we have to catch those parameters and add then to url. Hope to find a solution soon

Serhiy Hantsev 26 Oct 2021, 17:53

Yes, you have to take the url query from the landing page url and append it to the outgoing urls. For example, if a user clicks on a google ad and lands on the following category page:

https://smanique.com/de/mobile/category/15-strap-apple-watch-serie-5-da-40mm-and-44mm?gclid=Tester123

When the user in the category page clicks on a product, the product url must contain the same url query of the category page:

https://smanique.com/de/mobile/product/621-classic-ace-quick-adjust-stainless-steel-band-apple-watch-38mm-40mm-41mm-and-42mm-44mm-45mm-strap?gclid=Tester123

And so on until the order confirmation page. So each url leading to a next page must consist of:

URL + URL QUERY OF THE LANDING PAGE

This is only necessary on AMP for the above talk. A thousand thanks.

Fred 27 Oct 2021, 10:50

Could you please disable Opcache for a while in your server configuration to let me edit AMP module files

Serhiy Hantsev 27 Oct 2021, 11:13

Opcache disabled, you can proceed, thanks.

Fred 27 Oct 2021, 11:22

ok, thanks

Serhiy Hantsev 27 Oct 2021, 11:34

Fred, I wanted to inform you that at the moment the redirects on our site are not working properly maybe because you are working on the site. If a user goes to the following link:

https://smanique.com/de/cinturini-apple-watch-da-38mm-40mm-41mm-e-42mm-44mm-45mm/584-varun-cinturino-sport-in-silicone-apple-watch-da-38mm-40mm-41mm-e-42mm-44mm-45mm.html

[Debug] This page has moved error as in the attached image.

Furthermore, the AMP version does not work just like the attached image.

We have stopped all our Marketing campaigns while you are working on the site. Let us know when you complete the job. A thousand thanks.

Attachments:

Desktop-Error.png (11 KiB)
AMP-Error.jpg (294.6 KiB)
Fred 27 Oct 2021, 11:36

Please try now, the parameter should work

Serhiy Hantsev 27 Oct 2021, 12:26

Thanks Fred, I did some tests and now the parameter is only passed from the category page to the product page. It should go through all the pages of the AMP site maybe putting the function you implemented in the head so that it is active on all the AMP pages.
Furthermore, if a user lands on a page not served by Google Ads and therefore without an url query, you could make sure that the following part does not appear in the url:
?gclid=
To make me understand, if a user goes to the category page without an url query:
https://smanique.com/en/mobile/category/13-bands-apple-watch-serie-3-da-38mm-e-42mm

If he clicks on a product inside the category page, the highlighted query url should not come out:
https://smanique.com/en/mobile/product/623-classic-ace-quick-adjust-stainless-steel-band-apple-watch-38mm-40mm-41mm-and-42mm-44mm-45mm-strap?gclid=

A thousand thanks.

Fred 27 Oct 2021, 13:28

That’s really too much work. We currently don’t have time to provide customization service. You need a developer who could add such functionality

Serhiy Hantsev 27 Oct 2021, 13:35

Thanks anyway Fred, in reality it is not a customization as you offer in AMP the possibility to add the Google Ads conversion tracking but it does not work because the GCLID is not passed trough pages and not read in the order confirmation page. Anyway, could you tell me how did you get the GCLID from the category page to the product page? I try to do it myself on the other pages. Thanks again.

Fred 27 Oct 2021, 14:23

We have used AMP documentation to build the module. Here is for an example https://amp.dev/documentation/components/amp-form/?format=websites, and that’s really hard to predict what particular customer will need. So I’m not sure that’s our problem.


Here is the description of what we have done:
to get product list we have to make a request to the module controller and pass parameters there
In the case of category page we have added extra parameter “gclid” You can find it in the file “/public_html/themes/alysum/templates/mobile/catalog/listing/category.tpl” the line 124

src="{$amp.global.urls.productListSource}&var={$smarty.now|date_format:'%H:%M:%S'}{if isset($smarty.get.gclid)}&gclid={$smarty.get.gclid}{/if}"

then we have to catch it in the controller file

/public_html/themes/alysum/templates/mobile/catalog/listing/ajaxFilter.php

add it after line 44 like this

$params['gclid'] = Tools::getValue('gclid');

then pass it to the product assembler file:

/public_html/modules/pk_amp/classes/ampProductHelper.php

add following code to the assembler loop and override current AMP link with a new one with parameter
after the line 291

if (isset($params['gclid'])) {
   $products_for_template[$key]['amp_link'] = $products_for_template[$key]['amp_link'].'?gclid='.$params['gclid'];
}

After that, every product in the product listing will have it

Serhiy Hantsev 27 Oct 2021, 17:34

Thanks Fred, I’ll try to solve the problem myself. I would like to ask you one more thing, although we have enabled AMP forcing on mobile from today I have seen that if I use chrome developer tools with the mobile user agent the site is not redirected to AMP. Can you check what the problem is? I am attaching a video with a site with the Alysum theme that redirects while mine does not. Thanks again.
https://monosnap.com/file/O6c2lxmTNfHgan3UR1Vs8wRN520aiW

Serhiy Hantsev 28 Oct 2021, 13:34

Hello Fred, as we have stopped all our marketing campaigns while you are working on the site and we still have opcache disabled can you let us know if there are any updates regarding the last question I asked you? A thousand thanks.

Fred 28 Oct 2021, 16:24

Yes, I see what you talking about chrome, but I can’t understand why that’s happened.
I have tested out your website on different mobile devices it load AMP correctly
You can enable cache back if you need

Serhiy Hantsev 30 Oct 2021, 07:19

Hello Fred, I created a development environment for the site and tried to install a backup from a month ago to see if the problem was due to the recent changes. Unfortunately the same problem remains. In practice, when I activate the mobile user agent on Chrome, the site tries to go to the mobile version but then it is redirected to the web version as in the attached image. Maybe Chrome has made some changes to its mobile emulator. However, since on real mobile devices the site works as it should for the moment I don’t give too much weight to this problem. Also as regards the tracking I made an appointment with Google technical support, I hope they can solve the problem, if so I will let you know. You can close the ticket, thanks for your support and your patience, I wish you a good day and good work.

Attachments:

Redirect Error AMP Chrome.png (19.8 KiB)
Fred 30 Oct 2021, 09:13

But everything works correctly on real devices, who use chrome to browse websites in that way? That’s only for developers

Serhiy Hantsev 30 Oct 2021, 09:16

In fact, as I said too, thanks again.

Fred 30 Oct 2021, 09:28

You are welcome :)