Skip to content

Commit

Permalink
tealium fix
Browse files Browse the repository at this point in the history
  • Loading branch information
karla-vm committed Feb 15, 2024
1 parent eb3562e commit d25b6a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 3 additions & 4 deletions services/ui-src/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@
/>
<!-- Tealium Analytics Tag Manager -->
<script>
var nodeEnv = window._env_.STAGE;
var tealiumEnvMap = {
val: "qa",
production: "production",
"mdctqmr.cms.gov": "production",
"mdctqmrval.cms.gov": "qa",
};
var tealiumEnv = tealiumEnvMap[nodeEnv] || "dev";
var tealiumEnv = tealiumEnvMap[window.location.hostname] || "dev";
var tealiumUrl = `https://tags.tiqcdn.com/utag/cmsgov/cms-general/${tealiumEnv}/utag.sync.js`;
document.write(`<script src="${tealiumUrl}" async><\/script>`);
</script>
Expand Down
7 changes: 6 additions & 1 deletion services/ui-src/src/utils/tracking/tealium.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ export const fireTealiumPageView = (user, url, pathname) => {
pathname.endsWith("CSQ");
const contentType = isReportPage ? "form" : "app";
const sectionName = isReportPage ? pathname.split("/")[1] : "main app";
const tealiumEnvMap = {
"mdctmcr.cms.gov": "production",
"mdctmcrval.cms.gov": "qa",
};
const tealiumEnv = tealiumEnvMap[window.location.hostname] || "dev";
const { host: siteDomain } = url ? new URL(url) : null;
if (window.utag) {
window.utag.view({
Expand All @@ -15,7 +20,7 @@ export const fireTealiumPageView = (user, url, pathname) => {
page_name: sectionName + ":" + pathname,
page_path: pathname,
site_domain: siteDomain,
site_environment: process.env.NODE_ENV,
site_environment: tealiumEnv,
site_section: sectionName,
logged_in: !!user,
});
Expand Down

0 comments on commit d25b6a0

Please sign in to comment.