-
AuthorPosts
-
July 29, 2022 at 4:30 am #1359776
hi we have a website, i want install google tag manager, I don’t know how to install.
<head>
<!– Google Tag Manager –>
<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=
‘https://www.googletagmanager.com/gtm.js?id=’+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,’script’,’dataLayer’,’GTM-xxxxxxx’);</script>
<!– End Google Tag Manager –><body>
<!– Google Tag Manager (noscript) –>
<noscript><iframe src=”https://www.googletagmanager.com/ns.html?id=GTM-xxxxxx”
height=”0″ width=”0″ style=”display:none;visibility:hidden”></iframe></noscript>
<!– End Google Tag Manager (noscript) –>can help me?
I didn’t use child themes (Demo Import)
July 29, 2022 at 10:31 am #1359788Best practice with any WordPress site is to install a child theme.
Otherwise you will need a plugin to do this.
You can either write your own plugin or use one like the example below from the wordpress plugin library – Sorry I just reworded this bit. It didnt make sense.You can download a plugin like this one instead: WP Headers and Footers
If you use the built in Enfold Cookie popups – You must put your Google Tag Manager code into the Google Services Box in the Enfold Control Panel. Otherwise the cookie popups just wont work.
If not you can just add everything using the plugin instead but this wont be compliant with GDPR because it will load unconditionally on every page.
use the plugin to add your Body tag script on all pages in the body of the aritcle.
Otherwise you can use the code below to insert the snipped from the functions.php file in your child theme or a custom plugin that mimics the functions file.
// Add Google Tag code which is supposed to be placed after opening body tag. add_action( 'wp_body_open', 'tj_add_custom_body_open_code' ); function tj_add_custom_body_open_code() { echo ' INSERT YOUR GOOGLE BODY TAG HERE '; }
- This reply was modified 2 years, 3 months ago by thinkjarvis.
- This reply was modified 2 years, 3 months ago by thinkjarvis.
- This reply was modified 2 years, 3 months ago by thinkjarvis.
- This reply was modified 2 years, 3 months ago by thinkjarvis.
July 29, 2022 at 11:21 am #1359810August 1, 2022 at 8:41 am #1360070Hi,
thanks for your help.I have succeeded, used WP Headers and Footers pluginAugust 1, 2022 at 12:02 pm #1360088Hi strongpower123,
We’re happy to hear that :)
Thanks for using Enfold and have a great day!Best regards,
Nikko -
AuthorPosts
- The topic ‘enfold google tag manager install’ is closed to new replies.