@mparticle/web-google-analytics-4-client-kit 3.22.0 → 3.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1062,6 +1062,22 @@ function buildViewCart(event, affiliation) {
|
|
|
1062
1062
|
|
|
1063
1063
|
var commerceHandler = CommerceHandler;
|
|
1064
1064
|
|
|
1065
|
+
// Cleans a URL with the core SDK's rule, so GA4 receives the same page URL as
|
|
1066
|
+
// mParticle events. A core without mParticle._cleanUrl predates that rule; the
|
|
1067
|
+
// kit then sends a 'full' URL unchanged, as it did before, and cuts a 'path' URL
|
|
1068
|
+
// at the first ? or #.
|
|
1069
|
+
function cleanUrl(href, mode) {
|
|
1070
|
+
if (window.mParticle && typeof window.mParticle._cleanUrl === 'function') {
|
|
1071
|
+
return window.mParticle._cleanUrl(href, mode);
|
|
1072
|
+
}
|
|
1073
|
+
if (!href) {
|
|
1074
|
+
return '';
|
|
1075
|
+
}
|
|
1076
|
+
return mode === 'path' ? href.split(/[?#]/)[0] : href;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
var pageUrl = cleanUrl;
|
|
1080
|
+
|
|
1065
1081
|
function EventHandler(common) {
|
|
1066
1082
|
this.common = common || {};
|
|
1067
1083
|
}
|
|
@@ -1117,9 +1133,9 @@ EventHandler.prototype.logPageView = function(event) {
|
|
|
1117
1133
|
var LEGACY_GA_LOCATION = 'Google.Location';
|
|
1118
1134
|
var LEGACY_GA_REFERRER = 'Google.DocumentReferrer';
|
|
1119
1135
|
|
|
1120
|
-
var pageLocation = location.href;
|
|
1136
|
+
var pageLocation = pageUrl(location.href, 'full');
|
|
1121
1137
|
var pageTitle = document.title;
|
|
1122
|
-
var pageReferrer = document.referrer;
|
|
1138
|
+
var pageReferrer = pageUrl(document.referrer, 'path');
|
|
1123
1139
|
|
|
1124
1140
|
if (event.CustomFlags) {
|
|
1125
1141
|
if (event.CustomFlags.hasOwnProperty(TITLE)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mparticle/web-google-analytics-4-client-kit",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.23.0",
|
|
4
4
|
"author": "mParticle Developers <developers@mparticle.com> (https://www.mparticle.com)",
|
|
5
5
|
"description": "mParticle integration sdk for Google Analytics",
|
|
6
6
|
"main": "dist/GoogleAnalytics4EventForwarderClientSide-Kit.common.js",
|