Skip to content

Commit

Permalink
Update Analytics for EU (#1827)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cea2aj committed Jun 28, 2023
1 parent 00971e4 commit 7b449e1
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 7b449e1

Please sign in to comment.