- This topic has 42 replies, 3 voices, and was last updated 3 years, 3 months ago by
David.
-
AuthorPosts
-
December 28, 2022 at 3:47 am #2475556
Georgi
Thanks, Ying!
David – I put the code you told me in the hook, but the thank you page started crashing. When a customer completes an order, he is redirected to the thank you page and it’s completely blank.
So I guess it doesn’t work.
December 28, 2022 at 12:02 pm #2476061Ying
StaffCustomer SupportHi Georgi,
I thought I replied that the code should be added to
functions.phpor the code snippet plugin.It would NOT work in a hook.
December 28, 2022 at 12:18 pm #2476091Georgi
Hi Ying,
I realized that afterwards and moved it to the functions.php but it still doesn’t track anything.
December 29, 2022 at 2:47 am #2476642David
StaffCustomer SupportWhilst viewing the thank you page, Right Click > Inspect the page to open the browser developers tools.
In the developers tools there is theElementstab, select that and use CTRL-F to open the search, and search for part of your script eg.gtag.If the code work then you should be able to see your script in the
headof your site.December 29, 2022 at 10:58 pm #2477607Georgi
I opened the developer tools and made a purchase. On the thank you page I searched in Elements like you told me and found the gtag. However developer tools also report an error that gtag is not defined: https://prnt.sc/KIR9YVXfouJZ
Any clue what’s happening?
December 30, 2022 at 2:43 am #2477713David
StaffCustomer SupportOk, so the hook is working, the
gtag is not definedwill mean that the gtag.js has not been loaded.
I assume that means you haven’t hooked in your GTAG scripts for that page ?December 30, 2022 at 3:32 am #2477741Georgi
you haven’t hooked in your GTAG scripts for that page?
What do you mean? What I did only is to put the code in functions.php
Besides that, I’ve a hook created with GP for the Google Ads tracking code to work only on 1 product category which is currently showing ads for.December 30, 2022 at 3:50 am #2477758David
StaffCustomer SupportThat function you added is just a GTAG, and that requires the Google Tag Manager to be added to the site and loaded before the GTAG script is fired.
Have you added google tag manager to your site ?
December 30, 2022 at 3:53 am #2477762Georgi
Ah, no. The idea was to put code directly in pages via GP hooks/functions.php to avoid using GTM plugin.
December 30, 2022 at 4:24 am #2477777David
StaffCustomer SupportSee this doc for adding GTM using hooks:
https://docs.generatepress.com/article/implement-google-tag-manager/
December 31, 2022 at 12:36 am #2478616Georgi
I’m not well-versed in GTM, so I have to ask:
Technically, if I add the GTM code from the artictle you sent me only on the thank you page, will it measure conversions?
I have a GTM account but I haven’t set up anything in it. I guess just copying my GTM ID and putting in the code from the article will still not measure conversions value?
January 5, 2023 at 12:08 am #2484255Georgi
Okay, I implemented the code from the article today
https://prnt.sc/Rymz27yqCFBX
https://prnt.sc/FX-6PJLshpQxI didn’t make them show up for the entire site but only on the thank you page via this code you gave me earlier:
I hope it will finally start measuring conversions.
January 5, 2023 at 4:45 am #2484495David
StaffCustomer SupportI hope so too.
-
AuthorPosts
- You must be logged in to reply to this topic.