• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

In RH2019, new ui, parse error when trying to configure Google Analytics with my RH project

Participant ,
May 04, 2020 May 04, 2020

Copy link to clipboard

Copied

I have added the following code to the header of the master page:

 

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-000000000-0" ></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-000000000-0');

</script>

 

where UA-000000000-0 is my Google Analytics Tracking ID.

 

And Robohelp is giving me a parse error for the first line of the script saying invalid character s and underlining the s of the src. I tried adding it this way 

 

<script src="https://www.googletagmanager.com/gtag/js?id=UA-000000000-0" async ></script>

 

(as I found a website that seemed to suggest that you add the async at the end) but then got Invalid character > underlining the > next to async. 

 

I got this code from the Google Analytics website.

 

 

Views

854

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 04, 2020 May 04, 2020

I think it's actually the async bit. Try changing to: 

<script async="" src="https://www.googletagmanager.com/gtag/js?id=UA-000000000-0" ></script>

 

 

Votes

Translate

Translate
Community Expert ,
May 04, 2020 May 04, 2020

Copy link to clipboard

Copied

Try adding a forward slash after the closing double quote marks. I had something similar with Google Fonts.

 

Help others by clicking Correct Answer if the question is answered. Found the answer elsewhere? Share it here. "Upvote" is for useful posts.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 04, 2020 May 04, 2020

Copy link to clipboard

Copied

I think it's actually the async bit. Try changing to: 

<script async="" src="https://www.googletagmanager.com/gtag/js?id=UA-000000000-0" ></script>

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 05, 2020 May 05, 2020

Copy link to clipboard

Copied

Thank you very much Amebr, that worked!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 07, 2021 Oct 07, 2021

Copy link to clipboard

Copied

Thank you! It seems to be working, indeed. The error message is gone now. Do you know if the location of this script is correct (within the <head> section)? 

anthonka_0-1633601877617.png

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 07, 2021 Oct 07, 2021

Copy link to clipboard

Copied

LATEST

Mine looks like this:

googleanalyticsscript.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
RoboHelp Documentation
Download Adobe RoboHelp