-
Notifications
You must be signed in to change notification settings - Fork 283
Normalization for GA4 custom event name #396
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
Conversation
Going to leave this as a draft PR until I deploy & test in staging, and until after change freeze ends on Tuesday |
packages/destination-actions/src/destinations/google-analytics-4/customEvent/index.ts
Outdated
Show resolved
Hide resolved
packages/destination-actions/src/destinations/google-analytics-4/customEvent/index.ts
Outdated
Show resolved
Hide resolved
import { client_id } from '../ga4-properties' | ||
|
||
const normalize_event_name = (name: string, lowercase: boolean | undefined): string => { | ||
name = name.trim() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trim so we can avoid outputting something like: ___Event_Name__
packages/destination-actions/src/destinations/google-analytics-4/customEvent/index.ts
Outdated
Show resolved
Hide resolved
packages/destination-actions/src/destinations/google-analytics-4/customEvent/index.ts
Outdated
Show resolved
Hide resolved
@nick-Ag Can we update the Event Name description in the Custom Event action to say something like this?
|
import type { Payload } from './generated-types' | ||
import { client_id } from '../ga4-properties' | ||
|
||
const normalize_event_name = (name: string, lowercase: boolean | undefined): string => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, camelCase would be convention for function names, but not a blocker.
Since custom events sent to google cannot include spaces in the event name, this removes spaces before sending and introduces a toggle for users to convert the event name to lowercase.
Testing
Tested in staging and all looks good:

