Skip to content

Commit

Permalink
Merge a977ebb into ad4a9ba
Browse files Browse the repository at this point in the history
  • Loading branch information
benmcginnis committed Jun 28, 2023
2 parents ad4a9ba + a977ebb commit 5498cf8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/core/utils/urlutils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { PRODUCTION, SANDBOX } from '../constants';
import { CloudRegion } from '@yext/search-core';
import { PRODUCTION, SANDBOX, CLOUD_REGION } from '../constants';
import SearchParams from '../../ui/dom/searchparams';
import StorageKeys from '../storage/storagekeys';
import ComponentTypes from '../../ui/components/componenttypes';
Expand All @@ -17,6 +18,9 @@ export function getLiveApiUrl (env = PRODUCTION) {
* @param {boolean} conversionTrackingEnabled If conversion tracking has been opted into.
*/
export function getAnalyticsUrl (env = PRODUCTION, conversionTrackingEnabled = false) {
if (isEu()) {
return 'https://www.eu.yextevents.com';
}
if (conversionTrackingEnabled) {
return env === SANDBOX
? 'https://sandbox-realtimeanalytics.yext.com'
Expand All @@ -27,6 +31,10 @@ export function getAnalyticsUrl (env = PRODUCTION, conversionTrackingEnabled = f
: 'https://answers.yext-pixel.com';
}

function isEu () {
return CLOUD_REGION.toLowerCase() === CloudRegion.EU.toString();
}

/**
* Returns the passed in url with the passed in params appended as query params
* Note: query parameters in the url are stripped, you should include those query parameters
Expand Down

0 comments on commit 5498cf8

Please sign in to comment.