This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Inserting Google tags

  • Creator
    Topic
  • #18956
    gofetch
    Participant

    I am trying to insert this Google Tag code into the footer of every page on my website. Should I just go into each page and use the Text tab and place it at the bottom? Any help is appreciated. Thank you.

    (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({‘gtm.start’:
    new Date().getTime(),event:’gtm.js’});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!=’dataLayer’?’&l=’+l:”;j.async=true;j.src=
    ‘//www.googletagmanager.com/gtm.js?id=’+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,’script’,’dataLayer’,’GTM-MQVBVJ’);

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #18959
    Jason Bobich
    Keymaster

    Hello,

    I would suggest incorporating through a child theme.

    How a child theme works:

    https://vimeo.com/70832266

    A basic example of what you could do from your child theme’s functions.php, and simply hooking to wp_footer:

    function my_google_tag() {
    	?>
    	your output would go here...
    	<?php
    }
    add_action('wp_footer', 'my_google_tag');
Viewing 1 replies (of 1 total)
  • The forum ‘Barely Corporate Responsive WordPress Theme’ is closed to new topics and replies.