Site logo

[Resolved] Tracking Google Ads Events on a Category and Thank You Page

Home Forums Support [Resolved] Tracking Google Ads Events on a Category and Thank You Page

Home Forums Support Tracking Google Ads Events on a Category and Thank You Page

Viewing 13 posts - 31 through 43 (of 43 total)
  • Author
    Posts
  • #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.

    #2476061
    Ying
    Staff
    Customer Support

    Hi Georgi,

    I thought I replied that the code should be added to functions.php or the code snippet plugin.

    It would NOT work in a hook.

    #2476091
    Georgi

    Hi Ying,

    I realized that afterwards and moved it to the functions.php but it still doesn’t track anything.

    #2476642
    David
    Staff
    Customer Support

    Whilst viewing the thank you page, Right Click > Inspect the page to open the browser developers tools.
    In the developers tools there is the Elements tab, 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 head of your site.

    #2477607
    Georgi

    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?

    #2477713
    David
    Staff
    Customer Support

    Ok, so the hook is working, the gtag is not defined will mean that the gtag.js has not been loaded.
    I assume that means you haven’t hooked in your GTAG scripts for that page ?

    #2477741
    Georgi

    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.

    #2477758
    David
    Staff
    Customer Support

    That 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 ?

    #2477762
    Georgi

    Ah, no. The idea was to put code directly in pages via GP hooks/functions.php to avoid using GTM plugin.

    #2477777
    David
    Staff
    Customer Support
    #2478616
    Georgi

    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?

    #2484255
    Georgi

    Okay, I implemented the code from the article today

    https://prnt.sc/Rymz27yqCFBX
    https://prnt.sc/FX-6PJLshpQx

    I didn’t make them show up for the entire site but only on the thank you page via this code you gave me earlier:

    https://prnt.sc/qanrmShBkGgU

    I hope it will finally start measuring conversions.

    #2484495
    David
    Staff
    Customer Support

    I hope so too.

Viewing 13 posts - 31 through 43 (of 43 total)
  • You must be logged in to reply to this topic.