Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1092118

    Google is insisting that my conversion tracking code appear on only one page. I have noticed that on a previous thread (https://kriesi.at/support/topic/google-ads-set-up-conversion-tracking/) that the following code was recommended. However, the moderator added that the code will appear on every page. How can I embed the code on only one page?

    function hazlitt_add_goole_scripts(){
    if (is_page(9012)) {
    ?>
    <script async src=”https://www.googletagmanager.com/gtag/js?id=AW-123456789″></script>
    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag(‘js’, new Date());

    gtag(‘config’, ‘AW-123456789’);
    </script>
    <script>
    gtag(‘event’, ‘conversion’, {‘send_to’: ‘AW-123456789/xxxxxx_NUD’});
    </script>
    <?php
    }
    }
    add_action(‘wp_head’, ‘hazlitt_add_goole_scripts’);

    #1092971

    Hey John,

    Do you mean that the code is placed only on one page or you want it to have it on multiple pages?

    Best regards,
    Basilis

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.