Commit a47ef8fa authored by hass's avatar hass
Browse files

DX: Renamed getInternalUrl() to getPageUrl()

parent b64bce0d
......@@ -30,10 +30,10 @@ console.log("Check if base_url + '/go/foo' url is internal special. Expected: tr
console.log("Check if base_url + '/node/1' url is internal special. Expected: false, Result: %s.", Drupal.googleanalytics.isInternalSpecial(base_url + '/node/1'));
console.groupEnd();
console.group("Test 'getInternalUrl':");
console.log("Get absolute internal url from full qualified url. Expected: '/node/1', Result: '%s'.", Drupal.googleanalytics.getInternalUrl(base_url + '/node/1'));
console.log("Get absolute internal url from absolute url. Expected: '/node/1', Result: '%s'.", Drupal.googleanalytics.getInternalUrl('/node/1'));
console.log("Get full qualified external url. Expected: 'http://example.com/node/2', Result: '%s'.", Drupal.googleanalytics.getInternalUrl('http://example.com/node/2'));
console.group("Test 'getPageUrl':");
console.log("Get absolute internal url from full qualified url. Expected: '/node/1', Result: '%s'.", Drupal.googleanalytics.getPageUrl(base_url + '/node/1'));
console.log("Get absolute internal url from absolute url. Expected: '/node/1', Result: '%s'.", Drupal.googleanalytics.getPageUrl('/node/1'));
console.log("Get full qualified external url. Expected: 'http://example.com/node/2', Result: '%s'.", Drupal.googleanalytics.getPageUrl('http://example.com/node/2'));
console.groupEnd();
console.group("Test 'getDownloadExtension':");
......
......@@ -20,11 +20,11 @@ $(document).ready(function() {
// Is download tracking activated and the file extension configured for download tracking?
else if (Drupal.settings.googleanalytics.trackDownload && Drupal.googleanalytics.isDownload(this.href)) {
// Download link clicked.
ga("send", "event", "Downloads", Drupal.googleanalytics.getDownloadExtension(this.href).toUpperCase(), Drupal.googleanalytics.getInternalUrl(this.href));
ga("send", "event", "Downloads", Drupal.googleanalytics.getDownloadExtension(this.href).toUpperCase(), Drupal.googleanalytics.getPageUrl(this.href));
}
else if (Drupal.googleanalytics.isInternalSpecial(this.href)) {
// Keep the internal URL for Google Analytics website overlay intact.
ga("send", "pageview", { page: Drupal.googleanalytics.getInternalUrl(this.href) });
ga("send", "pageview", { page: Drupal.googleanalytics.getPageUrl(this.href) });
}
}
else {
......@@ -55,7 +55,7 @@ $(document).ready(function() {
$(document).bind("cbox_complete", function () {
var href = $.colorbox.element().attr("href");
if (href) {
ga("send", "pageview", { page: Drupal.googleanalytics.getInternalUrl(href) });
ga("send", "pageview", { page: Drupal.googleanalytics.getPageUrl(href) });
}
});
......@@ -138,7 +138,7 @@ Drupal.googleanalytics.isInternalSpecial = function (url) {
* @return string
* Internal website URL
*/
Drupal.googleanalytics.getInternalUrl = function (url) {
Drupal.googleanalytics.getPageUrl = function (url) {
var extractInternalUrl = new RegExp("^(https?):\/\/" + window.location.host, "i");
return url.replace(extractInternalUrl, '');
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment