This repository has been archived by the owner on Dec 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only push events if the datalayer exists
- Loading branch information
1 parent
da4944f
commit 8587119
Showing
1 changed file
with
8 additions
and
8 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 |
---|---|---|
@@ -1,19 +1,19 @@ | ||
export const pageLoad = (window) => { | ||
const dataLayer = window.dataLayerNativeX || []; | ||
dataLayer.push({ event: 'page_load' }); | ||
const dataLayer = window.dataLayerNativeX; | ||
if (dataLayer) dataLayer.push({ event: 'page_load' }); | ||
}; | ||
|
||
export const outboundLink = (window, url) => { | ||
const dataLayer = window.dataLayerNativeX || []; | ||
dataLayer.push({ event: 'outbound_click', outbound_url: url, eventTimeout: 3000 }); | ||
const dataLayer = window.dataLayerNativeX; | ||
if (dataLayer) dataLayer.push({ event: 'outbound_click', outbound_url: url, eventTimeout: 3000 }); | ||
}; | ||
|
||
export const share = (window, provider) => { | ||
const dataLayer = window.dataLayerNativeX || []; | ||
dataLayer.push({ event: 'share', social_provider: provider }); | ||
const dataLayer = window.dataLayerNativeX; | ||
if (dataLayer) dataLayer.push({ event: 'share', social_provider: provider }); | ||
}; | ||
|
||
export const endOfContent = (window) => { | ||
const dataLayer = window.dataLayerNativeX || []; | ||
dataLayer.push({ event: 'scroll_to_bottom' }); | ||
const dataLayer = window.dataLayerNativeX; | ||
if (dataLayer) dataLayer.push({ event: 'scroll_to_bottom' }); | ||
}; |