The Big Spring Sale! Up to 50% off!

Google site tags not working in "Additional Head HTML" section

newline
17 Posts
newline posted this 22 February 2024
Wishlist

When I try to use Google site tags in the Nicepage Site Settings -> HTML -> Additional Head HTML, the resulting page ends up erroring in the developer tools -> inspection -> Console errors.

tag error 1 -> (index):5687 Uncaught ReferenceError: gtag is not defined
tag error 2 -> GET https://www.googletagmanager.com/gtag/js?id=AW-XXXXXXXX

This is the code used (with some omissons on the actual tag ID:

window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'AW-XXXXXXXX');

gtag('event', 'conversion', {'send_to': 'AW-XXXXXXXX/9NiBCMOXXXXXXXXxz26ac9'});

I have reviewed the answer to this post below, but I did already test this with the comments removed (as seen above):
https://nicepage.com/questions/93052/adding-html-script-to-the-site-settings-html

When I remove from Nicepage and put it directly in the theme header.php file, it works fine without the same console errors. This seems to indicate that Nicepage is not properly handling the somehow.

When I try to use Google site tags in the Nicepage Site Settings -> HTML -> Additional Head HTML, the resulting page ends up erroring in the developer tools -> inspection -> Console errors. tag error 1 -> (index):5687 Uncaught ReferenceError: gtag is not defined tag error 2 -> GET https://www.googletagmanager.com/gtag/js?id=AW-XXXXXXXX This is the code used (with some omissons on the actual tag ID: window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'AW-XXXXXXXX'); gtag('event', 'conversion', {'send_to': 'AW-XXXXXXXX/9NiBCMOXXXXXXXXxz26ac9'}); I have reviewed the answer to this post below, but I did already test this with the comments removed (as seen above): https://nicepage.com/questions/93052/adding-html-script-to-the-site-settings-html When I remove from Nicepage and put it directly in the theme header.php file, it works fine without the same console errors. This seems to indicate that Nicepage is not properly handling the somehow.

Last edited 05 March 2024 by Support Team

Vote to pay developers attention to this features or issue.
9 Replies
Order By: Standard | Newest
Support Team
Support Team posted this 23 February 2024

Hello Joshua,

You need to place your Google Tag Manager ID with Site Settings > Google.
Please try and let us know.

If you are already using Google Analytics ID with the Google tab, GTM cannot be added too.
You can continue to input only GTM ID (correct one) to the Google>>Site Settings and add your GA script to the Site Settings >> HTML >> Additional Head.

...................................................
Sincerely,
Anna.
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hello Joshua, You need to place your Google Tag Manager ID with Site Settings > Google. Please try and let us know. If you are already using Google Analytics ID with the Google tab, GTM cannot be added too. You can continue to input only GTM ID (correct one) to the Google>>Site Settings and add your GA script to the Site Settings >> HTML >> Additional Head. ................................................... Sincerely, Anna. Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
newline
17 Posts
newline posted this 26 February 2024

So, from what I'm understanding (please correct me if I'm wrong) ...
1) I cannot use both the Google Analytics ID and the Google Tag Manager fields at the same time. :(
2) I cannot use the Google Analytics ID section and put the Google Tag in the Additional HTML section.
3) I can user the Google Tag section and put the Analytics in the Additional HTML section.

Further question ... does the Google Tag Manager work with the newly issued tags starting with "AW" ?

So, from what I'm understanding (please correct me if I'm wrong) ... 1) I **cannot** use both the Google Analytics ID and the Google Tag Manager fields at the same time. :( 2) I **cannot** use the Google Analytics ID section and put the Google Tag in the Additional HTML section. 3) I **can** user the Google Tag section and put the Analytics in the Additional HTML section. Further question ... does the Google Tag Manager work with the newly issued tags starting with "AW" ?
Support Team
Support Team posted this 26 February 2024

Hello Joshua,

Both IDs added to the Site settings for Google Analytics and Google Tag Manager are being excess. Ids can be used only one at a time. In the case of using both, GTM ID only will be written in the code as a script.
To avoid this you can continue to input only GTM id to the Google-Site Settings and add your GA script to the HTML-Site Settings.
One more way is to deploy Universal Analytics with Tag Manager.
Google support documentation you will find here - https://support.google.com/tagmanager/answer/6107124?hl=en&ref_topic=6333310
https://blog.hubspot.com/marketing/google-tag-manager-guide

Google Ads tags starting with "AW", please check Google documentation to learn more.
...................................................
Sincerely,
Anna.
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hello Joshua, Both IDs added to the Site settings for Google Analytics and Google Tag Manager are being excess. Ids can be used only one at a time. In the case of using both, GTM ID only will be written in the code as a script. To avoid this you can continue to input only GTM id to the Google-Site Settings and add your GA script to the HTML-Site Settings. One more way is to deploy Universal Analytics with Tag Manager. Google support documentation you will find here - https://support.google.com/tagmanager/answer/6107124?hl=en&ref_topic=6333310 https://blog.hubspot.com/marketing/google-tag-manager-guide Google Ads tags starting with "AW", please check Google documentation to learn more. ................................................... Sincerely, Anna. Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
newline
17 Posts
newline posted this 29 February 2024

I have converted the Google tags to GTM and imported the individual application tags. I have loaded the Nicepage settings -> Google with the GTM tag only. I can see the tag in the website source page output. When I run a test from https://tagassistant.google.com it does not find the tag.

I've noticed that the tags are low in the page source code. According to Google, these tags should be inserted "high in the section". It seems you are not loading it high in the head section at all. Is this the source of the issue?

I have converted the Google tags to GTM and imported the individual application tags. I have loaded the Nicepage settings -> Google with the GTM tag only. I can see the tag in the website source page output. When I run a test from https://tagassistant.google.com it does not find the tag. I've noticed that the tags are low in the page source code. According to Google, these tags should be inserted "high in the section". It seems you are not loading it high in the head section at all. Is this the source of the issue?
Support Team
Support Team posted this 01 March 2024

Hello Joshua,

This answer from Google support forum might be helpful - https://support.google.com/tagassistant/answer/2954338?hl=en&ref_topic=6000201&sjid=17805375909509982720-EU

You can adjust the placement of the GTM container code in your Site Settings >> HTML >> Additional Head HTML and run your test once again.
If Tag Assistant still doesn't detect the GTM tag, check for any errors or warnings in the console of your browser's developer tools. This can provide insights into any potential issues with the implementation.
If you're still encountering issues after following these steps, consider reaching out to Google Tag Manager support.

...................................................
Sincerely,
Anna.
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hello Joshua, This answer from Google support forum might be helpful - https://support.google.com/tagassistant/answer/2954338?hl=en&ref_topic=6000201&sjid=17805375909509982720-EU You can adjust the placement of the GTM container code in your Site Settings >> HTML >> Additional Head HTML and run your test once again. If Tag Assistant still doesn't detect the GTM tag, check for any errors or warnings in the console of your browser's developer tools. This can provide insights into any potential issues with the implementation. If you're still encountering issues after following these steps, consider reaching out to Google Tag Manager support. ................................................... Sincerely, Anna. Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
newline
17 Posts
newline posted this 02 March 2024

I got it working, it took a little time for Google to pick it up. I have the GTM code in the GTM section (not the additional code section). In my Google Tag Manager dashboard I have both Ads and Analytics associated with the GTM. So it's very nice now that I have converted the tags to GTM, and the one input field works well. My only critique, is that Google says the Google tag section should be the highest possible position in the head section. But when I look at the resulting source code, it is very low in the output. So, this would not be something for me to change, but this would be the way in which the Nicepage development has input the tag section into the code.

It works, but I wonder if it's optimized given it's page position.

I got it working, it took a little time for Google to pick it up. I have the GTM code in the GTM section (not the additional code section). In my Google Tag Manager dashboard I have both Ads and Analytics associated with the GTM. So it's very nice now that I have converted the tags to GTM, and the one input field works well. My only critique, is that Google says the Google tag section should be the highest possible position in the head section. But when I look at the resulting source code, it is very low in the output. So, this would not be something for me to change, but this would be the way in which the Nicepage development has input the tag section into the code. It works, but I wonder if it's optimized given it's page position.
Support Team
Support Team posted this 04 March 2024

Hello Joshua,

Glad it works.
Thank you for your explanation, we will forward this notice about the GTM section low in the source code to our developers team. Please share the link to your page as an example.

...................................................
Sincerely,
Anna.
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hello Joshua, Glad it works. Thank you for your explanation, we will forward this notice about the GTM section low in the source code to our developers team. Please share the link to your page as an example. ................................................... Sincerely, Anna. Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
newline
17 Posts
newline posted this 05 March 2024

Example sites:
https://tinyurl.com/yaewtxky
https://tinyurl.com/yc8pkvj6

Example sites: https://tinyurl.com/yaewtxky https://tinyurl.com/yc8pkvj6
JRC
53 Posts
JRC posted this yesterday

I'm in agreement with Joshua.
There's definitely some weird stuff in terms of NicePage generating working HTML, and Google Tag Manager and Google Analytics liking it.

I just recently started getting messages from Google like:
Your Google Tag code isn’t configured correctly, which may soon prevent your property from measuring automatic events. To fix this, place your Google Tag configuration code in the correct location on all pages that measure events.

^^ And since I'm not the once placing the Tag configuration code in the HTML to begin with, NOT a fun thing to try and do after the fact. The HTML generation, and the placement of Google Tags and/or GA4 IDs is critical.

They also had a Learn more link, which brings you here:
https://support.google.com/analytics/answer/14847402

Maybe your techs can review to better optimize the output.

Took me a while to find it, but I'm running Nicepage v6.9.2

I'm in agreement with Joshua. There's definitely some weird stuff in terms of NicePage generating working HTML, and Google Tag Manager and Google Analytics liking it. I just recently started getting messages from Google like: Your Google Tag code isn’t configured correctly, which may soon prevent your property from measuring automatic events. To fix this, place your Google Tag configuration code in the correct location on all pages that measure events. ^^ And since I'm not the once placing the Tag configuration code in the HTML to begin with, NOT a fun thing to try and do after the fact. The HTML generation, and the placement of Google Tags and/or GA4 IDs is critical. They also had a Learn more link, which brings you here: https://support.google.com/analytics/answer/14847402 Maybe your techs can review to better optimize the output. Took me a while to find it, but I'm running Nicepage v6.9.2

Last edited yesterday by JRC

You must log in or register to leave comments