Skip to content

Commit

Permalink
Merge pull request #47 from yext/removeWWW
Browse files Browse the repository at this point in the history
Pixels: Remove www prefix from yextevents URLs

Remove www from yextevent urls and tests.

J=FUS-5824
R=abenno, mtian
TEST=auto

The automatic checks in the github repo pass.
In addition, ran test-site in the analytics repo and fired off events.
All URL's with the yextevents domain did not have a www prefix.
  • Loading branch information
ejaffee01 committed Aug 10, 2023
2 parents 1a0f1a2 + fe7f73a commit 768b4ca
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
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

0 comments on commit 768b4ca

Please sign in to comment.