Skip to content

Commit

Permalink
parameterize coveo ID (#810)
Browse files Browse the repository at this point in the history
  • Loading branch information
cheungaryk authored Oct 17, 2024
1 parent 7c8c26a commit e12e776
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/partials/head/head-scripts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
8 changes: 2 additions & 6 deletions src/partials/head/head-scripts/coveo-search-scripts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})();
</script>

Expand All @@ -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);
})();
</script>
3 changes: 1 addition & 2 deletions src/partials/head/head-scripts/coveo-ua-script.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
})();
</script>

0 comments on commit e12e776

Please sign in to comment.