Hi Kriesi Team,
I want to correctly install the Google Tag Manger and it is asking for 2 codes to be added:
1. “Paste this code as high in the <head> of the page as possible” –> I added this to Enfold –> Google Services –> Google Analytics Tracking Code and believe this should be fine. Please correct if wrong.
2. “Additionally, paste this code immediately after the opening <body> tag” –> I do NOT see an easy option to add this in the same area. I found some old threads from 2018 on this that it needs to be added to the Enfold Child Theme or to the functions.php file and that when updating the Enfold Parent theme it won’t work any more… this sounds super complex and a bit like a nightmare if it’s so difficult.
Could you please advise me on the easiest option for adding the 2nd code snippet to have GTM installed correctly?
Thank you
have you checked if enfold does not do that if you put in that enfold options page of Google Analytics Tracking Code
______________
there is a hook directly after the opening body tag: ava_after_body_opening_tag
you can use it like this:
add_action('ava_after_body_opening_tag', function() {
echo '<div class="custom"></div>';
});
only if there is an advanced layer slider on that page – this will come first.
can you post here the code you had to insert ( replace your IDs if there are some inside with dummies )
maybe better – insert it to a copy of header.php directly and place that edited header.php in your child-theme folder.
BUT – if you had to be GDPR ( DSGVO ) compliant – this methods must be adjusted.