Google Tag Manager – Body
-
Hi,
What’s the best way to setup GTM for Woodmart theme?
There are two pieces of code to set this up, the first goes in the header section, and I have used the following plugin for this: https://wordpress.org/plugins/insert-headers-and-footers/
The second piece of code needs to go just after the <body> tag. I would assume manually editing the theme would cause issues when updating, so what’s the best solution for installing the body section code? Needs to load as early as possible in the body section.
Thank you,
Rob,
Hello,
Thank you so much for contacting our support center.
Try to add the following code to the functions.php file to “hook” your custom code right after the <body>
tag
function custom_code_body() {
?>
YOUR CODE GOES HERE (replace this text)
<?php
}
add_action( 'woodmart_after_body_open', 'custom_code_body', 1 );
Kind Regards
XTemos Studio