@mparticle/web-google-analytics-4-client-kit 1.2.0 → 1.3.1
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.
|
@@ -136,6 +136,17 @@ Common.prototype.standardizeParameters = function (parameters) {
|
|
|
136
136
|
};
|
|
137
137
|
|
|
138
138
|
Common.prototype.standardizeName = function (name) {
|
|
139
|
+
if (window.GoogleAnalytics4Kit.hasOwnProperty('setCustomNameStandardization')) {
|
|
140
|
+
try {
|
|
141
|
+
name = window.GoogleAnalytics4Kit.setCustomNameStandardization(name);
|
|
142
|
+
} catch (e) {
|
|
143
|
+
console.warn(
|
|
144
|
+
'Error calling setCustomNameStandardization callback. Check your callback. Data will still be sent without user-defined standardization. See our docs for proper use - https://docs.mparticle.com/integrations/google-analytics-4/event/',
|
|
145
|
+
e
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
139
150
|
// names of events and parameters have the following requirements:
|
|
140
151
|
// 1. They must only contain letters, numbers, and underscores
|
|
141
152
|
function removeForbiddenCharacters(name) {
|
|
@@ -958,6 +969,8 @@ IdentityHandler.prototype.onSetUserIdentity = function (
|
|
|
958
969
|
var identityHandler = IdentityHandler;
|
|
959
970
|
|
|
960
971
|
var initialization = {
|
|
972
|
+
// This name matches the mParticle database. This should not be changed unless the database name is being changed
|
|
973
|
+
// Changing this will also break the API for the cleansing data callback that a customer uses.
|
|
961
974
|
name: 'GoogleAnalytics4',
|
|
962
975
|
moduleId: 160,
|
|
963
976
|
/* ****** Fill out initForwarder to load your SDK ******
|
|
@@ -980,6 +993,13 @@ var initialization = {
|
|
|
980
993
|
) {
|
|
981
994
|
mParticle._setIntegrationDelay(this.moduleId, true);
|
|
982
995
|
|
|
996
|
+
// The API to allow a customer to provide the cleansing callback
|
|
997
|
+
// relies on window.GoogleAnalytics4Kit to exist. When MP is initialized
|
|
998
|
+
// via the snippet, the kit code adds it to the window automatically.
|
|
999
|
+
// However, when initialized via npm, it does not exist, and so we have
|
|
1000
|
+
// to set it manually here.
|
|
1001
|
+
window.GoogleAnalytics4Kit = window.GoogleAnalytics4Kit || {};
|
|
1002
|
+
|
|
983
1003
|
common.forwarderSettings = forwarderSettings;
|
|
984
1004
|
common.forwarderSettings.enableDataCleansing =
|
|
985
1005
|
common.forwarderSettings.enableDataCleansing === 'True';
|
|
@@ -988,7 +1008,7 @@ var initialization = {
|
|
|
988
1008
|
var hashUserId = forwarderSettings.hashUserId;
|
|
989
1009
|
|
|
990
1010
|
var configSettings = {
|
|
991
|
-
send_page_view: forwarderSettings.enablePageView === 'True'
|
|
1011
|
+
send_page_view: forwarderSettings.enablePageView === 'True',
|
|
992
1012
|
};
|
|
993
1013
|
window.dataLayer = window.dataLayer || [];
|
|
994
1014
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mparticle/web-google-analytics-4-client-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
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",
|