-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
22c65a7
commit b87ba61
Showing
3 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
export enum EventCategory { | ||
DETAILS_PAGE = 'Details page' | ||
} | ||
|
||
export enum EventAction { | ||
REQUEST_ACCESS = 'Request access' | ||
} | ||
|
||
type SiteImproveEventProps = { | ||
category: EventCategory; | ||
action: EventAction; | ||
label?: string | undefined; | ||
}; | ||
|
||
export const trackSiteImproveEvent = | ||
({ category, action, label }: SiteImproveEventProps) => | ||
() => { | ||
if (window._sz === undefined) { | ||
// eslint-disable-next-line no-console | ||
console.error('Unable to find Site Improve event library.'); | ||
} | ||
|
||
if (label) { | ||
window._sz.push(['event', category, action, label]); | ||
} else { | ||
window._sz.push(['event', category, action]); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
export declare global {} | ||
export {}; | ||
|
||
declare global { | ||
interface Window { | ||
_sz: { | ||
push: (event: [string, string, string, string?]) => void; | ||
}; | ||
} | ||
} |