Build hangs with Google Analytics code in master page

This forum is for all Flare issues related to the HTML5, WebHelp, WebHelp Plus, and Adobe Air Targets

Build hangs with Google Analytics code in master page

Postby minicyclist on Thu Mar 15, 2018 8:02 am

Hello,

Some of our larger projects are failing to build after we've added Google Analytics code to the topic master page - the build hangs at 'Resolving links in output files...'. Strangely, this only happens in larger (a few hundred topics) projects.

The code we've added is as follows (with the actual GA ID hidden):

Code: Select all
   <script async="1" src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXX-XX">
        </script>
        <script>
         window.dataLayer = window.dataLayer || [];
         function gtag(){dataLayer.push(arguments);}
         gtag('js', new Date());

         gtag('config', 'UA-XXXXXXX-XX');
      </script>


This is at the start of the <head> section in the master page.

I've tried moving the code around in the master page to no avail. The log doesn't give any clues. The fact that this works in smaller projects is leaving me mystified.

Grateful for advice.
minicyclist
Propeller Head
 
Posts: 52
Joined: Wed Apr 09, 2014 3:51 pm

Re: Build hangs with Google Analytics code in master page

Postby roboHAL on Tue Mar 27, 2018 10:55 am

Hi minicyclist.

I'm unable to tell you why your code is causing your build to hang. However, I can tell you I too am using google analytics in my master page, have over one thousand topics, and my builds do not "hang" or otherwise have any abnormalities.

The script code I've inserted is as follows, and needs to go within the head tag:

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-########-##', 'auto');
ga('send', 'pageview');

</script>


Hope that helps. :)
roboHAL
Sr. Propeller Head
 
Posts: 247
Joined: Mon Dec 31, 2012 9:57 am

Re: Build hangs with Google Analytics code in master page

Postby Dave Lee on Wed Mar 28, 2018 12:16 am

minicyclist wrote:I've tried moving the code around in the master page to no avail. The log doesn't give any clues. The fact that this works in smaller projects is leaving me mystifie


I use this same code, although I use it in a snippet, and I put it at the end of the body section of my master page, rather than in the head.

Works fine for me in all projects, including large projects (1500+ topics).

If you're having problems with only certain projects, then I'd check that something else isn't causing the problem.


roboHAL wrote:The script code I've inserted is as follows, and needs to go within the head tag:


That's the old 'ga' code for analytics.
It was replaced last year with the 'gtag' code, which minicyclist is using.
Dave Lee
Master Propellus Maximus
 
Posts: 5658
Joined: Mon Mar 05, 2007 8:33 am
Location: UK

Re: Build hangs with Google Analytics code in master page

Postby roboHAL on Wed Mar 28, 2018 3:27 am

Dave Lee wrote:That's the old 'ga' code for analytics.
It was replaced last year with the 'gtag' code, which minicyclist is using.


Hi David. Thank you. I'll preface my reply by stating that I am not a JAVA script coder. The code I wrote herein this thread was provided to me - perhaps a little over a year ago - by my development staff.

Here is something I do know. It works! Meaning, statistics are being captured, and I have reason to believe the data is accurate.

So please allow me to ask you the following questions.

(1) In your opinion (or fact), is there an advantage to use the "other" more current gtag code, and if so, what is the advantage?

(2) In your opinion (or fact), is there a disadvantage to use the "other" more current code, with respect to the code I'm currently using?

Thank you, David. :)
roboHAL
Sr. Propeller Head
 
Posts: 247
Joined: Mon Dec 31, 2012 9:57 am

Re: Build hangs with Google Analytics code in master page

Postby Dave Lee on Wed Mar 28, 2018 4:40 am

roboHAL wrote:Hi David. Thank you. I'll preface my reply by stating that I am not a JAVA script coder. The code I wrote herein this thread was provided to me - perhaps a little over a year ago - by my development staff.

Here is something I do know. It works! Meaning, statistics are being captured, and I have reason to believe the data is accurate.


The code you've got would be copied and pasted from the Google Analytics site; it's generated for you when you view your 'tracking code'.

Google Analytics changed the tracking code format in around August 2017, from the old 'ga' format (like yours) to the new 'gtag' format (like minicyclist's).
So if you get your tracking code right now, it'll give you the 'gtag' code.

The old 'ga' code will still work fine now, and likely for a number of years, but going forward you want to be using 'gtag'.
Dave Lee
Master Propellus Maximus
 
Posts: 5658
Joined: Mon Mar 05, 2007 8:33 am
Location: UK

Re: Build hangs with Google Analytics code in master page

Postby roboHAL on Wed Mar 28, 2018 4:57 am

Dave Lee wrote:The old 'ga' code will still work fine now, and likely for a number of years, but going forward you want to be using 'gtag'.


Thank you, David.
roboHAL
Sr. Propeller Head
 
Posts: 247
Joined: Mon Dec 31, 2012 9:57 am

Re: Build hangs with Google Analytics code in master page

Postby minicyclist on Thu Mar 29, 2018 9:46 am

Thanks all.

Yes, I'd prefer to use the new code.

Thanks for recommendations Dave. Sadly it still won't work for us. It seems to be this line that's causing the problem:

Code: Select all
<script async="1" src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXX-XX">
        </script>


Given the lack of diagnostics it's hard to know what might be causing it. It may be that we have to revert to the old code but I'll flag it with Madcap.
minicyclist
Propeller Head
 
Posts: 52
Joined: Wed Apr 09, 2014 3:51 pm

Re: Build hangs with Google Analytics code in master page

Postby Dave Lee on Mon Apr 02, 2018 11:46 pm

minicyclist wrote:Thanks for recommendations Dave. Sadly it still won't work for us. It seems to be this line that's causing the problem:

Code: Select all
<script async="1" src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXX-XX">
        </script>


Given the lack of diagnostics it's hard to know what might be causing it. It may be that we have to revert to the old code but I'll flag it with Madcap.


I insert the whole code in my master page (actually in a snippet), after the body proxy, and before the end of the closing body tag.

I also have async="" rather than async="1". Not sure if that makes a difference.
Code: Select all
<script async="" src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXX-XX">
        </script>
Dave Lee
Master Propellus Maximus
 
Posts: 5658
Joined: Mon Mar 05, 2007 8:33 am
Location: UK

Re: Build hangs with Google Analytics code in master page

Postby minicyclist on Tue Apr 03, 2018 5:26 am

Thanks Dave. Yes, tried your suggestions but no luck. I have found out what is causing it though - I copied a target from a working project and it turned out that it was the 'Use lowercase filenames' option that was stalling the build. With this option unchecked, it builds fine. Now to find out why!
minicyclist
Propeller Head
 
Posts: 52
Joined: Wed Apr 09, 2014 3:51 pm

Re: Build hangs with Google Analytics code in master page

Postby agracer on Fri May 25, 2018 8:40 am

@minicyclist
I'm so glad I found your post. My build was hanging with the GA as well, and this hack did the trick!
agracer
Propeller Head
 
Posts: 23
Joined: Fri Aug 19, 2016 11:58 am

Re: Build hangs with Google Analytics code in master page

Postby asbahr+ on Mon Aug 05, 2019 12:21 pm

I have to check the "Use lowercase file names" option or many external links to help will break.

I tried putting the code in a snippet and that didn't work. My build hangs at Resolving links in output files....

Does anyone else have any other tips?

Thanks!
asbahr+
Propeller Head
 
Posts: 14
Joined: Tue Sep 29, 2015 4:54 am

Re: Build hangs with Google Analytics code in master page

Postby minicyclist on Wed Aug 07, 2019 8:25 am

I never worked out a solution. I'd log a bug with Madcap.
minicyclist
Propeller Head
 
Posts: 52
Joined: Wed Apr 09, 2014 3:51 pm


Return to Web-based Outputs

Who is online

Users browsing this forum: Google [Bot] and 3 guests