generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 4
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
a8fc23a
commit 95f3087
Showing
2 changed files
with
30 additions
and
31 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,35 +1,5 @@ | ||
// eslint-disable-next-line import/no-cycle | ||
import { loadScript, sampleRUM } from './aem.js'; | ||
import { sampleRUM } from './aem.js'; | ||
|
||
// Core Web Vitals RUM collection | ||
sampleRUM('cwv'); | ||
// add more delayed functionality here | ||
async function loadAdobeDTM() { | ||
await loadScript(`${window.hlx.codeBasePath}/scripts/jquery-3.7.1.min.js`); | ||
const prod = 'https://assets.adobedtm.com/a441b904b50e/7a4facbbcffb/launch-039be8795dc8.min.js'; | ||
const stage = 'https://assets.adobedtm.com/a441b904b50e/7a4facbbcffb/launch-a2ae4c3b0523-staging.min.js'; | ||
|
||
const searchParams = new URLSearchParams(window.location.search); | ||
const env = searchParams.get('launch'); | ||
if (env === 'prod') { | ||
loadScript(prod, { async: '' }); | ||
return; | ||
} | ||
|
||
if (env === 'stage') { | ||
loadScript(stage, { async: '' }); | ||
return; | ||
} | ||
|
||
const { host } = window.location; | ||
if (host === 'servicenow.com' || host === 'www.servicenow.com') { | ||
loadScript(prod, { async: '' }); | ||
} else { | ||
if (searchParams.get('disableLaunch') === 'true') { | ||
return; | ||
} | ||
loadScript(stage, { async: '' }); | ||
} | ||
} | ||
|
||
loadAdobeDTM(); |
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