I tried to add the Google Tag Manager to the header.php of my WordPress site. I used child theme "Hello Elementor", template from Envato with Elementor’s builder for placing and editing content to website.
I placed first code in header.php inside <head></head>
and second after <body <?php body_class(); ?>>
but didn’t have any result. After checking source code on page, there doesn’t show codes. Tag Assistance by Google no tags found.
Can somebody helps me to solve this issue, please)
2
Answers
I found solution in this tutorial video: https://www.youtube.com/watch?v=6iqeqmlKLyQ
For my case I used functions.php in which had placed specific code blocks:
and
First of all, why not use this all-in-one plugin by Google: https://wordpress.org/plugins/google-site-kit/
As for your question, I see three options here:
What code did you add? Did you paste code from GTM or did you use a
php
snippet? I’m asking because mostphp
implementations will not insert the code when a user is logged-in to WordPress. Try looking from another browser, or in incognito mode.Caching – did you make sure to clear it?
Did you change the correct file? Try adding a comment somewhere inside your
header.php
file and see if it shows up on your site.