Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:add check and replace warn instead of error for setCustomNameStan… #55

Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions packages/GA4Client/src/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,15 @@ Common.prototype.standardizeParameters = function (parameters) {
};

Common.prototype.standardizeName = function (name) {
try {
name = window.GoogleAnalytics4Kit.setCustomNameStandardization(name);
} catch (e) {
console.error(
'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/',
e
);
if (window.GoogleAnalytics4Kit.hasOwnProperty(setCustomNameStandardization)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setCustomNameStandardization is not a variable, but rather, a string

Suggested change
if (window.GoogleAnalytics4Kit.hasOwnProperty(setCustomNameStandardization)) {
if (window.GoogleAnalytics4Kit.hasOwnProperty('setCustomNameStandardization')) {

try {
name = window.GoogleAnalytics4Kit.setCustomNameStandardization(name);
} catch (e) {
console.warn(
'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/',
e
);
}
}

// names of events and parameters have the following requirements:
Expand Down
Loading