Skip to content
This repository was archived by the owner on Jun 30, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/GoogleAnalytics/MasterPageTracker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
<category>Behavior</category>
<description>The prefix that you want to be displayed in the Google Analytics. It is especially useful if you are using this widget in different apps while using the same tracked code (UA-XX-XXX)</description>
</property>
<property key="includePageName" type="boolean" defaultValue="true">
<caption>Include module and page name</caption>
<category>Behavior</category>
<description>The value determines whether the submitted url to Google Analytics will include both the module and page name</description>
</property>
<property key="trackIt" type="boolean" defaultValue="true">
<caption>Active</caption>
<category>Behavior</category>
Expand Down Expand Up @@ -76,4 +81,3 @@
</property>
</properties>
</widget>

28 changes: 17 additions & 11 deletions src/GoogleAnalytics/widget/MasterPageTracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,28 @@ define("GoogleAnalytics/widget/MasterPageTracker", [
}));
}
},

_buildFullPath: function(prefix, includePageName, oriMendixPath) {
if (includePageName) {
var pageExtension = ".page.xml";
var path = oriMendixPath.substr(0, oriMendixPath.length - pageExtension.length);
return prefix + "/" + path;
} else {
return prefix;
}
},
_addPage: function () {
logger.debug(this.id + "._addPage");
var pageExtension = ".page.xml";
var oriPath = this.mxform.path;
var path = oriPath.substr(0, oriPath.length - pageExtension.length);
if (typeof this.prefix !== "undefined" && this.prefix !== "") {
path = this.prefix + "/" + path;
this._replaceTags(this.prefix, lang.hitch(this, function(text) {
var path = this._buildFullPath(text, this.includePageName, this.mxform.path)
ga("send", {
"hitType": "pageview",
"page": path,
"title": this.mxform.title
});
}));
}
ga("send", {
"hitType": "pageview",
"page": path,
"title": this.mxform.title
});
}

});
});

Expand Down