google analytics api - GA Multiple websites showing 'Active Users' info in the same view -
is possible use google analytics api show active users sections multiple stores in same view? such:
want hide drop down combobox drives selection , want able trigger right event passing ua-12344-1 value load number of active users given site.
i'm trying code work triggers event when dropdown value changes in dropdown combobox ga account. want force multiple ga events fire on page load.
javascript
activeuserscom.once('success', function() { var element = this.container.firstchild; var timeout; this.on('change', function(data) { var element = this.container.firstchild; var animationclass = data.delta > 0 ? 'is-increasing' : 'is-decreasing'; element.classname += (' ' + animationclass); cleartimeout(timeout); timeout = settimeout(function() { element.classname = element.classname.replace(/ is-(increasing|decreasing)/g, ''); }, 3000); }); }); var viewselector = new gapi.analytics.ext.viewselector2({ container: 'view-selector-container', }).execute(); viewselector.on('viewchange', function(data) { // start tracking active users view. activeuserscom.set(data).execute(); });
html
<div id="view-selector-container"> <div class="viewselector2"> <div class="viewselector2-item"> <label>account</label> <select class="formfield"> <option selected="" value="89859">my ga account</option> </select> </div> <div class="viewselector2-item"> <label>website</label> <select class="formfield"> <option value="ua-819851-1">site 1</option> <option value="ua-819851-2">site 2</option> </select> </div> </div> </div>
Comments
Post a Comment