Skip to content

Commit c246d46

Browse files
chore(build): Generate latest bundle [skip ci]
1 parent c851914 commit c246d46

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

packages/GA4Client/dist/GoogleAnalytics4EventForwarderClientSide-Kit.common.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,15 @@ Common.prototype.standardizeParameters = function (parameters) {
136136
};
137137

138138
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+
139148
// names of events and parameters have the following requirements:
140149
// 1. They must only contain letters, numbers, and underscores
141150
function removeForbiddenCharacters(name) {
@@ -958,6 +967,8 @@ IdentityHandler.prototype.onSetUserIdentity = function (
958967
var identityHandler = IdentityHandler;
959968

960969
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.
961972
name: 'GoogleAnalytics4',
962973
moduleId: 160,
963974
/* ****** Fill out initForwarder to load your SDK ******
@@ -980,6 +991,13 @@ var initialization = {
980991
) {
981992
mParticle._setIntegrationDelay(this.moduleId, true);
982993

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+
9831001
common.forwarderSettings = forwarderSettings;
9841002
common.forwarderSettings.enableDataCleansing =
9851003
common.forwarderSettings.enableDataCleansing === 'True';
@@ -988,7 +1006,7 @@ var initialization = {
9881006
var hashUserId = forwarderSettings.hashUserId;
9891007

9901008
var configSettings = {
991-
send_page_view: forwarderSettings.enablePageView === 'True'
1009+
send_page_view: forwarderSettings.enablePageView === 'True',
9921010
};
9931011
window.dataLayer = window.dataLayer || [];
9941012

packages/GA4Client/dist/GoogleAnalytics4EventForwarderClientSide-Kit.iife.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,15 @@ var GoogleAnalytics4Kit = (function (exports) {
135135
};
136136

137137
Common.prototype.standardizeName = function (name) {
138+
try {
139+
name = window.GoogleAnalytics4Kit.setCustomNameStandardization(name);
140+
} catch (e) {
141+
console.error(
142+
'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/',
143+
e
144+
);
145+
}
146+
138147
// names of events and parameters have the following requirements:
139148
// 1. They must only contain letters, numbers, and underscores
140149
function removeForbiddenCharacters(name) {
@@ -957,6 +966,8 @@ var GoogleAnalytics4Kit = (function (exports) {
957966
var identityHandler = IdentityHandler;
958967

959968
var initialization = {
969+
// This name matches the mParticle database. This should not be changed unless the database name is being changed
970+
// Changing this will also break the API for the cleansing data callback that a customer uses.
960971
name: 'GoogleAnalytics4',
961972
moduleId: 160,
962973
/* ****** Fill out initForwarder to load your SDK ******
@@ -979,6 +990,13 @@ var GoogleAnalytics4Kit = (function (exports) {
979990
) {
980991
mParticle._setIntegrationDelay(this.moduleId, true);
981992

993+
// The API to allow a customer to provide the cleansing callback
994+
// relies on window.GoogleAnalytics4Kit to exist. When MP is initialized
995+
// via the snippet, the kit code adds it to the window automatically.
996+
// However, when initialized via npm, it does not exist, and so we have
997+
// to set it manually here.
998+
window.GoogleAnalytics4Kit = window.GoogleAnalytics4Kit || {};
999+
9821000
common.forwarderSettings = forwarderSettings;
9831001
common.forwarderSettings.enableDataCleansing =
9841002
common.forwarderSettings.enableDataCleansing === 'True';
@@ -987,7 +1005,7 @@ var GoogleAnalytics4Kit = (function (exports) {
9871005
var hashUserId = forwarderSettings.hashUserId;
9881006

9891007
var configSettings = {
990-
send_page_view: forwarderSettings.enablePageView === 'True'
1008+
send_page_view: forwarderSettings.enablePageView === 'True',
9911009
};
9921010
window.dataLayer = window.dataLayer || [];
9931011

0 commit comments

Comments
 (0)