generated from adobe/aem-boilerplate
-
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.
Merge pull request #196 from hlxsites/86-analytics
86 analytics
- Loading branch information
Showing
2 changed files
with
31 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 |
---|---|---|
@@ -1,7 +1,20 @@ | ||
// eslint-disable-next-line import/no-cycle | ||
import { sampleRUM } from './aem.js'; | ||
import { sampleRUM, loadScript } from './aem.js'; | ||
import { getEnvType } from './util.js'; | ||
|
||
// Core Web Vitals RUM collection | ||
sampleRUM('cwv'); | ||
|
||
// add more delayed functionality here | ||
async function loadAdobeLaunch() { | ||
const adobedtmSrc = { | ||
dev: 'https://assets.adobedtm.com/2079c5a4620d/addee6043c9b/launch-EN41458ac9f88145ac942b876e3362c32f-development.min.js', | ||
preview: 'https://assets.adobedtm.com/2079c5a4620d/addee6043c9b/launch-EN367ab3c0970e43a0afba6d1110494ef4-staging.min.js', | ||
live: 'https://assets.adobedtm.com/2079c5a4620d/addee6043c9b/launch-EN8919423a46da4e859aad8cef6f514471.min.js', | ||
}; | ||
await loadScript(adobedtmSrc[getEnvType()], { | ||
type: 'text/javascript', | ||
async: true, | ||
}); | ||
} | ||
|
||
if (!window.location.host.includes('localhost')) await loadAdobeLaunch(); |
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