Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove www prefix from yextevents URLs #46

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yext/analytics",
"version": "0.6.3",
"version": "0.6.4",
"description": "An analytics library for Yext",
"author": "slapshot@yext.com",
"license": "BSD-3-Clause",
Expand Down Expand Up @@ -75,4 +75,4 @@
"cross-fetch": "^3.1.5",
"ulidx": "^2.0.0"
}
}
}
6 changes: 3 additions & 3 deletions src/utils/endpointProviders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ type DomainMap = Record<Region, Record<Environment, string | undefined>>;

const EVENT_DOMAINS: DomainMap = {
US: {
PRODUCTION: 'https://www.us.yextevents.com',
SANDBOX: 'https://www.sbx.us.yextevents.com',
PRODUCTION: 'https://us.yextevents.com',
SANDBOX: 'https://sbx.us.yextevents.com',
},
EU: {
PRODUCTION: 'https://www.eu.yextevents.com',
PRODUCTION: 'https://eu.yextevents.com',
SANDBOX: undefined
}
};
Expand Down
2 changes: 1 addition & 1 deletion tests/infra/ChatAnalyticsReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const mockedResponse: EventAPIResponse = { id: '12345' };
it('should send events to the prod domain when configured', async () => {
const mockService = mockHttpRequesterService(mockedResponse);
const reporter = new ChatAnalyticsReporter(prodConfig, mockService);
const expectedUrl ='https://www.us.yextevents.com/accounts/me/events';
const expectedUrl ='https://us.yextevents.com/accounts/me/events';
const response = await reporter.report(payload);
expect(response).toEqual(mockedResponse);
expect(mockService.post).toBeCalledWith(
Expand Down
16 changes: 8 additions & 8 deletions tests/infra/PagesAnalyticsReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ it('The static page page view URL is constructed correctly', () => {
}, httpRequesterService);

reporter.pageView();
const expectedUrl = new URL('https://www.us.yextevents.com/store_pagespixel');
const expectedUrl = new URL('https://us.yextevents.com/store_pagespixel');

expectedUrl.searchParams.set('businessids', '0');
expectedUrl.searchParams.set('product', 'sites');
Expand Down Expand Up @@ -59,7 +59,7 @@ it('Should handle http errors properly', () => {

it('should track entity pages', () => {
const httpRequesterService = mockHttpRequesterService();
const expectedUrl = new URL('https://www.us.yextevents.com/store_pagespixel');
const expectedUrl = new URL('https://us.yextevents.com/store_pagespixel');
expectedUrl.searchParams.set('businessids', '0');
expectedUrl.searchParams.set('product', 'sites');
expectedUrl.searchParams.set('siteId', '0');
Expand Down Expand Up @@ -105,7 +105,7 @@ it('should track directory pages', () => {
}, httpRequesterService);
reporter.pageView();

const expectedUrl = new URL('https://www.us.yextevents.com/store_pagespixel');
const expectedUrl = new URL('https://us.yextevents.com/store_pagespixel');

expectedUrl.searchParams.set('businessids', '0');
expectedUrl.searchParams.set('product', 'sites');
Expand Down Expand Up @@ -137,7 +137,7 @@ it('should track locator pages', () => {
}, httpRequesterService);
reporter.pageView();

const expectedUrl = new URL('https://www.us.yextevents.com/store_pagespixel');
const expectedUrl = new URL('https://us.yextevents.com/store_pagespixel');
expectedUrl.searchParams.set('businessids', '0');
expectedUrl.searchParams.set('product', 'sites');
expectedUrl.searchParams.set('siteId', '0');
Expand Down Expand Up @@ -168,7 +168,7 @@ it('should track custom events', () => {
}, httpRequesterService);
reporter.track({eventType: eventName});

const expectedUrl = new URL('https://www.us.yextevents.com/store_pagespixel');
const expectedUrl = new URL('https://us.yextevents.com/store_pagespixel');

expectedUrl.searchParams.set('businessids', '0');
expectedUrl.searchParams.set('product', 'sites');
Expand Down Expand Up @@ -205,7 +205,7 @@ it('should use set the visitor', () => {

reporter.pageView();

const expectedUrl = new URL('https://www.us.yextevents.com/store_pagespixel');
const expectedUrl = new URL('https://us.yextevents.com/store_pagespixel');

expectedUrl.searchParams.set('businessids', '0');
expectedUrl.searchParams.set('product', 'sites');
Expand Down Expand Up @@ -343,7 +343,7 @@ it('should set pageDomain when specified and valid', () => {
}, httpRequesterService);

reporter.pageView();
const expectedUrl = new URL('https://www.us.yextevents.com/store_pagespixel');
const expectedUrl = new URL('https://us.yextevents.com/store_pagespixel');

expectedUrl.searchParams.set('businessids', '0');
expectedUrl.searchParams.set('product', 'sites');
Expand Down Expand Up @@ -382,7 +382,7 @@ it('should log a warning and not include the pageDomain if it is missing a schem
expect(console.warn).toBeCalledWith(errMsg1, errMsg2);

reporter.pageView();
const expectedUrl = new URL('https://www.us.yextevents.com/store_pagespixel');
const expectedUrl = new URL('https://us.yextevents.com/store_pagespixel');

expectedUrl.searchParams.set('businessids', '0');
expectedUrl.searchParams.set('product', 'sites');
Expand Down
6 changes: 3 additions & 3 deletions tests/infra/SearchAnalyticsReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ it('The URL is constructed correctly', () => {
const mockService = mockHttpRequesterService();
const analyticsReporter = new SearchAnalyticsReporter(config, mockService);
analyticsReporter.report({ type: 'SCROLL_TO_BOTTOM_OF_PAGE', queryId: '1' });
const expectedUrl = `https://www.us.yextevents.com/realtimeanalytics/data/answers/${config.businessId}`;
const expectedUrl = `https://us.yextevents.com/realtimeanalytics/data/answers/${config.businessId}`;
expect(mockService.post).toHaveBeenLastCalledWith(expectedUrl, expect.anything());
});

Expand All @@ -25,7 +25,7 @@ it('The URL is constructed correctly for EU', () => {
const analyticsReporter = new SearchAnalyticsReporter(configWithEURegion, mockService);
analyticsReporter.report({ type: 'SCROLL_TO_BOTTOM_OF_PAGE', queryId: '1' });
const expectedUrl
= `https://www.eu.yextevents.com/realtimeanalytics/data/answers/${configWithEURegion.businessId}`;
= `https://eu.yextevents.com/realtimeanalytics/data/answers/${configWithEURegion.businessId}`;
expect(mockService.post).toHaveBeenLastCalledWith(expectedUrl, expect.anything());
});

Expand All @@ -38,7 +38,7 @@ it('The URL is constructed correctly for Sandbox', () => {
const analyticsReporter = new SearchAnalyticsReporter(configWithSandboxEnv, mockService);
analyticsReporter.report({ type: 'SCROLL_TO_BOTTOM_OF_PAGE', queryId: '1' });
const expectedUrl
= `https://www.sbx.us.yextevents.com/realtimeanalytics/data/answers/${configWithSandboxEnv.businessId}`;
= `https://sbx.us.yextevents.com/realtimeanalytics/data/answers/${configWithSandboxEnv.businessId}`;
expect(mockService.post).toHaveBeenLastCalledWith(expectedUrl, expect.anything());
});

Expand Down