From e12e77664148d8553243363c006bb79844ebb693 Mon Sep 17 00:00:00 2001 From: Gary Cheung Date: Thu, 17 Oct 2024 10:08:35 -0700 Subject: [PATCH] parameterize coveo ID (#810) --- src/partials/head/head-scripts.hbs | 6 +++--- src/partials/head/head-scripts/coveo-search-scripts.hbs | 8 ++------ src/partials/head/head-scripts/coveo-ua-script.hbs | 3 +-- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/partials/head/head-scripts.hbs b/src/partials/head/head-scripts.hbs index 728957f04..3a14e7016 100644 --- a/src/partials/head/head-scripts.hbs +++ b/src/partials/head/head-scripts.hbs @@ -2,9 +2,9 @@ {{> gtm-scripts }} {{> segment-script }} {{/if}} -{{#if (or env.COVEO_API_KEY env.COVEO_API_KEY_JP)}} - {{> coveo-search-scripts org_id="org62salesforce"}} - {{> coveo-ua-script org_id="org62salesforce"}} +{{#if (and env.COVEO_ORG_ID (or env.COVEO_API_KEY env.COVEO_API_KEY_JP))}} + {{> coveo-search-scripts }} + {{> coveo-ua-script }} {{/if}} {{#if (eq (site-profile) 'review' )}} {{> review-site-scripts }} diff --git a/src/partials/head/head-scripts/coveo-search-scripts.hbs b/src/partials/head/head-scripts/coveo-search-scripts.hbs index eda322026..f187cbc3e 100644 --- a/src/partials/head/head-scripts/coveo-search-scripts.hbs +++ b/src/partials/head/head-scripts/coveo-search-scripts.hbs @@ -20,10 +20,9 @@ } } - const organizationId = "{{ org_id }}"; const searchToken = "{{#if (eq (site-profile) 'jp')}}{{env.COVEO_API_KEY_JP}}{{else}}{{env.COVEO_API_KEY}}{{/if}}"; - initSearch(organizationId, searchToken); + initSearch("{{ env.COVEO_ORG_ID }}", searchToken); })(); @@ -43,10 +42,7 @@ } } - {{#if (or env.COVEO_CR_API_KEY env.COVEO_CR_API_KEY_JP)}} - const organizationId = "{{ org_id }}"; const crToken = "{{#if (eq (site-profile) 'jp')}}{{env.COVEO_CR_API_KEY_JP}}{{else}}{{env.COVEO_CR_API_KEY}}{{/if}}" - initContentRecommendations(organizationId, crToken); - {{/if}} + initContentRecommendations("{{ env.COVEO_ORG_ID }}", crToken); })(); \ No newline at end of file diff --git a/src/partials/head/head-scripts/coveo-ua-script.hbs b/src/partials/head/head-scripts/coveo-ua-script.hbs index 789946516..0c5fce0f6 100644 --- a/src/partials/head/head-scripts/coveo-ua-script.hbs +++ b/src/partials/head/head-scripts/coveo-ua-script.hbs @@ -12,13 +12,12 @@ }); } - const organizationId = "{{ org_id }}"; const accessToken = "{{#if env.COVEO_API_KEY_JP}}{{env.COVEO_API_KEY_JP}}{{else}}{{env.COVEO_API_KEY}}{{/if}}"; const isProdSite = (hostname) => hostname === "docs.mulesoft.com"; if (isProdSite(window.location.hostname)) { - if (accessToken) initCoveoUserAnalytics(organizationId, accessToken); + if (accessToken) initCoveoUserAnalytics("{{ env.COVEO_ORG_ID }}", accessToken); } })(); \ No newline at end of file