How to configure google analytics for multiple environments of an application?

0
Hi Guys, I am trying to configure google analytics in my application. Have added a master page tracker in the layout page which has a corresponding tracking id generated from Google analytics. But how do i configure this for multiple environments? Say suppose i want to track my production and acceptance environments. Since the master page tracker should only be used once per application, is there a provision to add multiple tracker codes? How can we have the environments configured separately?
asked
2 answers
0

Never done it myself but for one i believe you can have views with filters in google Analytics. With the filters you should be able to filter on environment url:

https://support.google.com/analytics/answer/1034823?hl=en

answered
0

You can modify the widget to read the uacode from the db to make it runtime programmable, the relevant part is
 

...
_setupGlobalTrackerId: function () {
    ...
    //window.mxGoogleAnalytics = {trackerId: this.uaTrackCode}; ->
    window.mxGoogleAnalytics = {trackerId: this._contextObj.get(this.attr_uacode)};
},
...

 

answered