Picture of Mick  Leyden
Google Analytics
by Mick Leyden - Tuesday, 19 July 2016, 5:43 AM
 

Hi all,

I am in the process of moving our e-Learning content out of our LMS. We don’t need to conduct assessments or track who has completed a module, so I don’t want to put a login in front of users if I don’t need to. I would however, like to be able to gather some basic usage stats, such as unique visitors, time on site etc using google analytics.

I had hoped this would be a relatively straight forward process of sticking the tracking code from GA into the head tags of the index page of a published adapt module. Unfortunately that does not seem to be working. I have tested it using the google tag assistant extension and it is saying that it can find the GA tags but there is no HTTP response detected.

Do you think this is likely failing because of some factor inherent in the way the adapt module is structured, or do you think this approach should work but is failing for some other reason?

The course in question is here: http://cviclearn.azurewebsites.net/vec

Any thoughts or ideas would be very much appreciated!

Cheers

mick

Aniket Dharia
Re: Google Analytics
by Aniket Dharia - Tuesday, 19 July 2016, 6:50 AM
 

Hi Mick - 

You would need to develop a small extension which would embed the Google Analytics code. This would provide all information regarding user data that you require.

Do let us know if you would like to get this developed.

Regards,

Aniket Dharia

 

Picture of Paul Steven
Re: Google Analytics
by Paul Steven - Tuesday, 19 July 2016, 12:31 PM
 

I have successfully added Google Analytics tracking by placing the GA code just before the closing body tag in the index.html page.

Note my course was not SCORM and hence was run standalone rather than being loaded into an LMS. If you load it into an LMS you may find you need to add the GA code to one of the other files such as "index_lms.html" or "main.html" - not quite sure what the main.html file is used for to be honest.

Picture of Matt Leathes
Re: Google Analytics
by Matt Leathes - Tuesday, 19 July 2016, 1:26 PM
 

main.html is just a duplicate of index.html - but had to be left in for (backwards?) compatibility with the authoring tool which is (was?) set to use that as the preview launch page.

Picture of Paul Steven
Re: Google Analytics
by Paul Steven - Tuesday, 19 July 2016, 3:25 PM
 

Thanks Matt - that is good to know

Aniket Dharia
Re: Google Analytics
by Aniket Dharia - Tuesday, 19 July 2016, 3:29 PM
 

Hi Paul - 

If it worked without index.html, you can uninstall spoor and use it as a standard course without SCORM and I guess adding the GA details in the index.html file.

Thanks!

Regards,

Aniket

Picture of Paul Steven
Re: Google Analytics
by Paul Steven - Tuesday, 19 July 2016, 4:24 PM
 

Hi Aniket

Yes that is exactly what I did.

Thanks

Paul

Picture of Mick  Leyden
Re: Google Analytics
by Mick Leyden - Wednesday, 20 July 2016, 1:27 AM
 

Hi All,

Thanks for the suggestions and advice. I have got it to work just as Paul has described. I have also realised, it was failing yesterday because I still had uBlock turned on.... which raises some other interesting questions about tracking users with adblockers, but that is a problem for another day. :-)

Cheers

Mick

 

Picture of Dean Wilson
Re: Google Analytics
by Dean Wilson - Wednesday, 14 September 2016, 3:33 PM
 

Hi Paul

Thank you for posting this.. I've pretty much followed you exactly here, by removing spoor extension. And now, Google Tag Assistant at least recognises the GA tag. 

But I'm getting a "No http response detected" messages, which basically means it's still not working.

Did you encounter anything like this?

 

Regards
Dean 

Picture of Paul Steven
Re: Google Analytics
by Paul Steven - Wednesday, 14 September 2016, 3:58 PM
 

Hi Dean

Just to confirm, you are Downloading your course from the Builder and then editing the index.html file and adding in the Google Analytics code just before the closing body tag

 

So you will have something like the following:

<body>
<button id="accessibility-toggle" class="base button a11y-ignore-focus"></button>
<span id="accessibility-instructions" class="aria-label" role="region" tabindex="0"></span>
<div id="wrapper">
</div>


<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-XXXXXXX-XX, 'auto');
ga('send', 'pageview');

</script>

</body>

 

Then you are testing the files uploaded to a server?

 

 

 

 

Picture of Dean Wilson
Re: Google Analytics
by Dean Wilson - Wednesday, 14 September 2016, 4:57 PM
 

Thanks for responding Paul.

I've made everything in the framework, but yes, I've edited the index.html pretty much exactly as you've shown here, placed the correct GA code just above the closing body tag.

I've uploaded the whole thing to a subdomain via FTP.  

It might be worth mentioning that I 'uninstalled' spoor simply by deleting the extension folder from the main source folder. If this isn't a proper uninstall, this could be a problem? 

 

Picture of Matt Leathes
Re: Google Analytics
by Matt Leathes - Wednesday, 14 September 2016, 5:52 PM
 

deleting the adapt-contrib-spoor folder (and its contents) from src/extensions (followed by a $ grunt build) is a perfectly safe way to remove the spoor extension

Picture of Simon Date
Re: Google Analytics
by Simon Date - Wednesday, 5 October 2016, 3:31 PM
 

I've just created a pretty simple extension to enable Google Analytics in your course, it pastes in the code above and allows you to enter in your Google Analytics identifier. Check it out here.

It works with the Framework and Authoring Tool. I've also tested it in SCORM and it worked fine within our LMS (Moodle).

Picture of Oliver Foster
Re: Google Analytics
by Oliver Foster - Wednesday, 5 October 2016, 5:10 PM
 

Awesome! Will have a look. Cheers Simon.

Picture of Matt Leathes
Re: Google Analytics
by Matt Leathes - Wednesday, 5 October 2016, 6:31 PM
 

Nice one Simon! Could prove very useful to quite a few people.

Picture of Amy Palmer
Re: Google Analytics
by Amy Palmer - Tuesday, 8 August 2017, 1:02 PM
 

Hi Simon, 

I've put your extension into my course and it is reporting back to GA in real time - so it's definitely working in some capacity.

However, it isn't recording anything except live views. I've run the GA Debugger and it's presenting this:

 

Is there anything obvious there that would suggest why it wasn't recording the data after the live event?

Any help would be great!

Thanks,

Amy

Picture of Simon Date
Re: Google Analytics
by Simon Date - Wednesday, 9 August 2017, 12:52 PM
 

Hi Amy,

Our team only uses the plugin to track live views. If you want to gain further analytics from Adapt I would recommend looking into some of the xAPI plugins.

Sorry I couldn't be of more help!

Cheers,

Simon