Support Forum Support Forum GDPR Cookie Compliance Trigger a conversion tracking tag

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • September 14, 2023 @ 2:01 pm

    Hi there,

    We’ve currently got a Google Ads conversion tag set to load in the head of our contact form submission page, however, we can see in the Chrome Inspector that this conversion tag is loading before the Cookie Compliance plugin is loading the GA Tag so it’s generating an error in the console and failing to record the conversion.  We obviously need this conversion tag to load only after the GA Tag has loaded.  How can this be achieved?

    Thanks,
    Ian.

    Moove Agency
    September 15, 2023 @ 8:11 am

    Hi Ian,

    Thanks for using our plugins.

    Are you able to put the Google Ads conversion tag inside of the GDPR plugin too?

     

    September 15, 2023 @ 8:49 am

    I wondered that but the issue is that the conversion tag must only be loaded on the conversation page so there would need to be some way of only loading that part of the code based on a URL condition.  Is there a way to add conditional logic into that code?

    Moove Agency
    September 15, 2023 @ 8:57 am

    There might be, the best is to check our Documentation. It’s part of the plugin, if you go to the CMS > GDPR > Documentation

    It lists all available hooks and scripts that you can use with our plugin.

    Hope this helps.

    September 15, 2023 @ 9:32 am

    I’ve found a way to make this work, which might help your other users.

    To get Google Ads’ conversion tag to load ‘after’ the main GA tracking code, I placed a global variable in the <head> of the conversion page

    <script> var conversionPage = true; </script>

    I then added the following script into the GDPR Cookie Compliance plugin (for the relevant cookie type) under the GA tracking code.

    <!– Global site tag (gtag.js) – Google Ads: XXXXXXXXX –>
    <script async src=”;
    <script>
    console.log(‘ga tag loaded’);
    window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag(‘js’, new Date()); gtag(‘config’, ‘AW-XXXXXXXXX’);
    </script>

    <script>
    if (typeof conversionPage !== ‘undefined’ && conversionPage === true) {
    console.log(‘gtag conversions loaded’);
    gtag(‘event’, ‘conversion’, {
    ‘send_to’: ‘AW-XXXXXXXXX/[your conversion ID here]’,
    ‘transaction_id’: ”
    }); // Google Ads Conversion Tag
    }
    </script>

    You could include the LinkedIn conversion tag into that function too, just make sure to add the main LinkedIn tracking tag above this script.

    Moove Agency
    September 15, 2023 @ 9:56 am

    Wonderful, thank you for sharing the solution!

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Trigger a conversion tracking tag’ is closed to new replies.