[MGNLDEMO-85] Re-add Google analytics Marketing Tag to demo Created: 20/Jul/15  Updated: 11/Nov/16  Resolved: 28/Jul/15

Status: Closed
Project: Magnolia Demo Projects
Component/s: None
Affects Version/s: 0.5
Fix Version/s: 0.6

Type: Bug Priority: Major
Reporter: Christopher Zimmermann Assignee: Federico Grilli
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0d
Time Spent: 3h
Original Estimate: Not Specified

Attachments: PNG File ga-config.png    
Issue Links:
relation
is related to MGNLGA-17 Remove STK dependency Closed
is related to MGNLDEMO-91 Add Google analytics Marketing Tag to... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Epic Link: Travel Demo
Sprint: Sprint 4 (Basel)
Story Points: 2

 Description   

The following marketing tag should be added to the demo. Ask Ben for details.

<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','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-6575210-7', 'auto');
ga('send', 'pageview');
</script>


 Comments   
Comment by Federico Grilli [ 28/Jul/15 ]

Prior to 5.4 this was the job of GA module which wraps a rather old jQuery plugin for GA (http://devblog.jasonhuck.com/2007/11/19/google-analytics-integration-with-jquery/) and adds the ability to configure some parameters via JCR. The scripts were eventually loaded by STK. Our GA module continues to provide those scripts which need some Freemarker pre-processing before one can use them.
Now in 5.4 w/o STK and with the new resources mechanism one has the following options

  • add those files manually directly to the desired page e.g.
    <script src="/resources/google-analytics/js/init-gatracker"></script>
    <script src="/resources/google-analytics/js/jquery-gatracker"></script>
    
  • refer to the js at /default/templates/prototype/jsFiles see
    Please notice how this uses the legacy and no longer recommended resources mechanism (using /resources instead of /.resources) to serve the resources after doing some Freemarker pre-processing (see https://documentation.magnolia-cms.com/display/DOCS/Resources#Resources-Youcanstilluse/resourcesforprocessedresources)
    Of course, jQuery must be available and be loaded before the two scripts. Also, the loading order of the scripts is important, thus init-gatracker must precede jquery-gatracker.
Comment by Ben Price [ 10/Aug/15 ]

I still don't see the tracking code on the pages and no results are coming through.
Is this change waiting to be published?

Comment by Federico Grilli [ 10/Aug/15 ]

Yes, this will be available as of Magnolia 5.4.1 which should hopefully be released end of this week.

Comment by Zak Greant [ 24/Aug/15 ]

Hey Folks,

I think we need to look at this again.

In the past, we tracked visits to the author instance of the demo. Now it seems that we're only tracking visits to the public instance. Both would be best, but if we have to choose one, then author would be most preferable.

Cheers!
--zak

Comment by Federico Grilli [ 24/Aug/15 ]

True, sorry for the inconvenience. I filed a follow-up ticket, see MGNLDEMO-91. As soon as MGNLDEMO 0.7 will be released - which might also happen before Magnolia 5.4.2 - it can be added to our demo.

Generated at Mon Feb 12 05:16:08 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.