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