Google Tag manager Install

Please give me the steps to install goole tag manager. I installed the child theme x and opened the functions.php. But I cant see this part in the function.php

add_action(‘wp_head’, ‘add_header_code’);
function add_header_code(){
?>

<!-- Add the Google Tag Manager here -->

<?php

};

Hi Dylan,

You will have to add that code in the functions.php then place the GTM code in the <!-- Add the Google Tag Manager here --> part of the code.

Hope this helps.

Hi I cant see this tag in the functions.php file. Where is the file located. I installed the child x and then opened the functions.php. Is that the correct place?

I installed Google Tag Manager for WordPress plugin also. Its still not triggering. Please give me step by step instructions to get this done. TKs

Hi Dylan,

As previously mentioned, you have to add the code that you mentioned to the functions.php file in the child theme if you cannot find the code present in the file.

Please install and activate the child theme and login through FTP then edit the functions.php then add this code:

add_action('wp_head', 'add_header_code'); 

function add_header_code(){ ?>

<!-- Add the Google Tag Manager here -->

<?php
};

Hope this is clear.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.