Jump to content

Help with adding Google Tag Manager code


Recommended Posts

Hi everyone! I apologize for what is probably a dumb question. 

I have two Google Tag codes that I need to have running on every page. Is there a specific way I should do this? There are no fields for it in the template. My first though was just echoing the tags with PHP on a file that runs everywhere. Is that possible? And if so what file would it be best to add it to?

I really appreciate your help, I have never used ProcessWire before.

Link to comment
Share on other sites

Hello webguy,

to integrate a Google tag on your site, you can integrate the code e.g. in the header template (sometimes _header.php).

But the answer is not quite that simple, as it depends on how the templates of your site are structured.

My templates usually look like this:

_header.php
_footer.php
home.php (include header, templatecontent, footer)
basic-page.php (include header, templatecontent, footer) ...
and so on ?

I hope this helps 

Link to comment
Share on other sites

Hi webguy,

Unless your client wants to be able to entre their Google Tag ID themselves, no need to create a field for that.
As markus-th said, just hard-code it in a partial template that is included on every page (the one that contains the <head> part of your pages).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...