-
AuthorPosts
-
May 28, 2024 at 9:37 pm #1446876
Can you please let me know how to add the Google tags to the site this is what I was provided for a Google ad campaign, the person setting it up sent me this code to add to each <head> section of each page
May 28, 2024 at 11:07 pm #1446886Hey schwabino,
Try adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:function custom_script() { ?> <script> <!– Google Tag Manager –> </script> <?php } add_action( 'wp_head', 'custom_script', 99 );
and replace <!– Google Tag Manager –> with your code.
Best regards,
MikeMay 28, 2024 at 11:33 pm #1446888This reply has been marked as private.May 28, 2024 at 11:53 pm #1446890May 29, 2024 at 8:49 pm #1446982This reply has been marked as private.May 30, 2024 at 6:20 am #1447012Hi,
Thank you for the info.
The theme is not updated to the latest version 5.7.1. Please update the theme, then add this code in the functions.php file:
function ava_g_tag_custom_script() { ?> <!-- 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-TX8QJW27'); </script> <!-- End Google Tag Manager --> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-TX8QJW27" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <!-- End Google Tag Manager (noscript) --> <?php } add_action( 'wp_head', 'ava_g_tag_custom_script', 99 );
We also recommend installing a child theme so that you can place and preserve the code in the child theme’s functions.php file: https://kriesi.at/documentation/enfold/child-theme/
Best regards,
IsmaelMay 30, 2024 at 7:17 pm #1447107This reply has been marked as private.May 30, 2024 at 7:19 pm #1447108This reply has been marked as private.May 31, 2024 at 4:55 am #1447142Hi,
Thank you for the update.
We added the code to the parent theme’s functions.php file. Please note that this code will be removed when you update the theme. We recommend installing a child theme or using a code injector such as the following:
// https://wordpress.org/plugins/wp-coder/
// https://wordpress.org/plugins/insert-php-code-snippet/Best regards,
IsmaelDecember 3, 2024 at 8:26 pm #1472819This reply has been marked as private.December 3, 2024 at 8:37 pm #1472821This reply has been marked as private.December 4, 2024 at 9:34 am #1472856Hi,
Did you try adding the code to your code snippets plugin? If that is not an option for you, then please install a child theme and add it as a function instead. Mike and Ismael has provided you with all the necessary information earlier in this thread.
Best regards,
RikardDecember 4, 2024 at 5:47 pm #1472940This reply has been marked as private.December 4, 2024 at 8:45 pm #1472952 -
AuthorPosts
- You must be logged in to reply to this topic.