Tagged: x
-
AuthorPosts
-
May 12, 2016 at 9:18 am #987821
AlexParticipantHello,
I want to put my Google Tag Manager code instead of Google Analytics code. I know I need to strip the code off something for it to work properly, but I don’t remember what I should remove.
Here’s my GA code:
`(function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,’script’,’//www.google-analytics.com/analytics.js’,’ga’);ga(‘create’, ‘UA-69481740-1’, ‘auto’);
ga(‘send’, ‘pageview’);`And here’s the new GTM code I need to set up:
<!-- Google Tag Manager --> <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-TC8DXX" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <script>(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-TC8DXX');</script> <!-- End Google Tag Manager -->Can you tell me please how I must put it into the Customizer?
Thanks.
—
AlexMay 12, 2016 at 12:25 pm #988148
JoaoModeratorHi Alex,
We have Google Analytics Addon that is made specially for you to put your code in.
Please install it and you will find the place there to paste your code.
You can find the GA Addons at your W-Admin Dashboabord / Adoonds / Home
Hope that helps,
Joao
May 13, 2016 at 4:33 am #989419
AlexParticipantHello,
Thank you! But can I add Google Tag Manager code into the addon?
—
AlexMay 13, 2016 at 4:56 am #989442
ChristopherModeratorHi there,
Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.
Please add following code in child theme’s functions.php file :
// Add Google Tag Manager Code // ============================================================================= function add_google_tag_manager_code(){ ?> <!-- Google Tag Code starts here --> place the google tag manager code here <!-- Google Tag Code ends here --> <?php } add_action( 'wp_head', 'add_google_tag_manager_code' ); // End Add Google Tag Manager Code // =============================================================================Hope it helps.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-987821 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
