//Boostrap Google Analytics
(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;
a.crossorigin= "anonymous";
m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
sap.ui.define([
"sap/ui/core/UIComponent"
], function (UIComponent) {
"use strict";
return UIComponent.extend("ns.MyShellPluginModule.Component", {
metadata: {
manifest: "json"
},
/**
* The component is initialized by UI5 automatically during the startup of the app and calls the init method once.
* @public
* @override
*/
init: function () {
UIComponent.prototype.init.apply(this, arguments);
this.initGoogleAnalytics();
},
initGoogleAnalytics: function() {
//Get GA tracking ID from Portal configuration
var trackingID = "UA-********";
//Initalize the tracker
ga('create', trackingID, 'auto');
this.registerPortalSiteNavigationEvents();
},
registerPortalSiteNavigationEvents: function(){
//Track app and page navigation events
var oAppLifeCycle = sap.ushell.Container.getService("AppLifeCycle");
oAppLifeCycle.attachAppLoaded(function(oEvent){
var oParameters = oEvent.getParameters();
oParameters.getIntent().then(function(event){
var sSenanticObject = event.semanticObject;
ga('send', 'pageview', {
'page': sSenanticObject
});
});
}.bind(this));
}
});
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
26 | |
22 | |
19 | |
13 | |
10 | |
9 | |
9 | |
8 | |
7 | |
7 |