From a977ebb4cc7fcce367fd7890ee9757821484f8ed Mon Sep 17 00:00:00 2001 From: cea2aj <42848445+cea2aj@users.noreply.github.com> Date: Wed, 28 Jun 2023 12:56:20 -0400 Subject: [PATCH] Update Analytics for EU (#1827) When the cloud region is EU, send analytics events to https://www.eu.yextevents.com J=BACK-2362 TEST=manual Build EU and US versions locally. Connected them to a test jambo site and confirmed the EU and US events fire properly. Checked the user_events table in the EU and confirmed the events are there. --- src/core/utils/urlutils.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/core/utils/urlutils.js b/src/core/utils/urlutils.js index 17a6b51e9..3547ab3a3 100644 --- a/src/core/utils/urlutils.js +++ b/src/core/utils/urlutils.js @@ -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'; @@ -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' @@ -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