Highlighted

RH 2019: Google Analytics + Master Pages

Engaged ,
Jan 02, 2020

Copy link to clipboard

Copied

I've inserted Google Analytics tracking code into the header/footer of master pages in RH 2017 and older, without issue. Trying to do the same with a brand new project created in RH 2019 and am having trouble.

 

If I insert the following code (I've replaced my tracking id with Xs for this post) in the header of a master page, as directed by Google:

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

gtag('config', 'XXXXXXXXX');
</script>

 

RoboHelp identifies the following error:

The attribute  [ async ]  must have a value.

Invalid character  s

 

Additionally, RoboHelp won't let me switch from the master page's code-view to its edit-view. Instead, it pops up a "Parse Error" dialog at the bottom right corner of RH stating:

Line: 6, Column: 15, Message: Invalid character s

 

Finally, while RoboHelp will allow me to save the change, if I attempt to create a new topic using this master page, the Google Analytics script/code is omitted from the header of the NEW topic. Note: I've also tried this with the footer; the behavior/result is the same.

 

Thoughts?

Topics

New UI, Scripting

Views

519

Likes

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

RH 2019: Google Analytics + Master Pages

Engaged ,
Jan 02, 2020

Copy link to clipboard

Copied

I've inserted Google Analytics tracking code into the header/footer of master pages in RH 2017 and older, without issue. Trying to do the same with a brand new project created in RH 2019 and am having trouble.

 

If I insert the following code (I've replaced my tracking id with Xs for this post) in the header of a master page, as directed by Google:

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

gtag('config', 'XXXXXXXXX');
</script>

 

RoboHelp identifies the following error:

The attribute  [ async ]  must have a value.

Invalid character  s

 

Additionally, RoboHelp won't let me switch from the master page's code-view to its edit-view. Instead, it pops up a "Parse Error" dialog at the bottom right corner of RH stating:

Line: 6, Column: 15, Message: Invalid character s

 

Finally, while RoboHelp will allow me to save the change, if I attempt to create a new topic using this master page, the Google Analytics script/code is omitted from the header of the NEW topic. Note: I've also tried this with the footer; the behavior/result is the same.

 

Thoughts?

Topics

New UI, Scripting

Views

520

Likes

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
Adobe Community Professional ,
Jan 02, 2020

Copy link to clipboard

Copied

RoboHelp 2019 you said

 

Classic or the new baby?

Likes

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
Reply
Loading...
Engaged ,
Jan 02, 2020

Copy link to clipboard

Copied

New.

Likes

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
Reply
Loading...
Adobe Community Professional ,
Jan 02, 2020

Copy link to clipboard

Copied

On the Madcap forums, async always causes an error in Flare.

 

Change it to async="" and it shouldn't throw an error any more.

 

EDIT: That's recommended by the scripting guru on the madcap forums. But if it doesn't work try asyn="async" as per w3 schools https://www.w3schools.com/tags/att_script_async.asp

Likes

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
Reply
Loading...
Engaged ,
Jan 03, 2020

Copy link to clipboard

Copied

Removing "src" and going with just "async" resolved the RoboHelp error. Thank you!

Likes

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
Reply
Loading...
Adobe Community Professional ,
Jan 03, 2020

Copy link to clipboard

Copied

Don't remove src, otherwise it won't work at all.

 

This is the change:
<script async="" src="https://www.googletagmanager.com/gtag/js?id=XXXXXXXXX"></script>

Likes

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
Reply
Loading...