Google Tracking Codes
Permalink
Is there any new ways to add google tracking codes besides from the SEO tool in Concrete? It doesn't go where Google wants it:
Install Google Tag Manager
Copy the code below and paste it onto every page of your website.
Paste this code as high in the <head> of the page as possible:
and:
Additionally, paste this code immediately after the opening <body> tag:
I really just need to know what type of file to look for in my file manager so I can edit the head tag directly. I don't see the old index.html type of thing but I see a php file.
Can anyone send me a screenshot of what the file would look like in a directory.
Install Google Tag Manager
Copy the code below and paste it onto every page of your website.
Paste this code as high in the <head> of the page as possible:
and:
Additionally, paste this code immediately after the opening <body> tag:
I really just need to know what type of file to look for in my file manager so I can edit the head tag directly. I don't see the old index.html type of thing but I see a php file.
Can anyone send me a screenshot of what the file would look like in a directory.
If you login to the Dashboard -> System & Settings -> Tracking Codes you can put it in the "Header Tracking Codes" box and it will get into the <head> element.
Did you see what I was saying?
Yes it does put it in the head but it does a reckless job and not where Google wants it in the head or the body. So what I really need is to know what file my html is hiding in and some idea where to look for it in a file manager.
Yes it does put it in the head but it does a reckless job and not where Google wants it in the head or the body. So what I really need is to know what file my html is hiding in and some idea where to look for it in a file manager.
Look in your theme header.php file and place your code in there.
Ya - it's silly that this has been a thing for nearly 10 years and they still haven't implemented an easy way to plug in the GTM tags. Now - being a coder, a reply like, "Just alter you header.php file in whatever theme you're using" is easy enough - but imagine the frustration for the non-coders. It's just silly that they have an area for tags, but nothing for GTM to be plugged in properly. I mean, it's not like Google runs the world's most advanced and note-worthy index / crawl / search engines. Why bother with such a small fry? Obviously C5 holds far more water than Google. I think it's Google's turn to conform to C5 - I mean, right?
How about using custom attribute to embed Google Tag Manager code?
You need a bit of coding, but we can manage it simple like this.
1. Create Custom Attribute from Dashboard.
Dash Board -> System & Settings -> Name & Attributes Then you click "Manage Attribute" then you can add Custom Attributes.
Add text area and set handle and name e.g. "GTM_HEAD", "GTM_BODY"
Save your GTM tracking code in the text area
2. Edit header.php in your theme file
Below <head> tag add this code,
<?= Core::make('site')->getSite()->getAttribute('GTM_HEAD');
Below <body> tag add this code,
<?= Core::make('site')->getSite()->getAttribute('GTM_BODY');
Hope it works with you.
You need a bit of coding, but we can manage it simple like this.
1. Create Custom Attribute from Dashboard.
Dash Board -> System & Settings -> Name & Attributes Then you click "Manage Attribute" then you can add Custom Attributes.
Add text area and set handle and name e.g. "GTM_HEAD", "GTM_BODY"
Save your GTM tracking code in the text area
2. Edit header.php in your theme file
Below <head> tag add this code,
<?= Core::make('site')->getSite()->getAttribute('GTM_HEAD');
Below <body> tag add this code,
<?= Core::make('site')->getSite()->getAttribute('GTM_BODY');
Hope it works with you.
Thank you for this idea Matt!
Thank you so much mattshimazaki for the code