From 390786a5cf7bd17a80d42b26bdff87c3b6d7f0a6 Mon Sep 17 00:00:00 2001 From: Bryan Lee Date: Tue, 8 Apr 2025 14:01:10 -0400 Subject: [PATCH 1/6] EventsSDK: update pageUrl and referrerUrl defaults Changed the defaults for the pageUrl and referrerUrl so they no longer use the Referrer header as a default. Also increased SDK version to 1.0.3 --- package.json | 2 +- src/AnalyticsEventReporter.ts | 10 ++++++++++ src/EventPayload.ts | 8 ++------ tests/AnalyticsEventReporter.test.ts | 24 ++++++++++++------------ 4 files changed, 25 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 8fab97f..ffaf088 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@yext/analytics", - "version": "1.0.2", + "version": "1.0.3", "description": "An analytics library for Yext", "author": "fusion@yext.com", "license": "BSD-3-Clause", diff --git a/src/AnalyticsEventReporter.ts b/src/AnalyticsEventReporter.ts index 4f61c62..fb7bd08 100644 --- a/src/AnalyticsEventReporter.ts +++ b/src/AnalyticsEventReporter.ts @@ -78,6 +78,16 @@ export class AnalyticsEventReporter implements AnalyticsEventService { }); } + /** If pageUrl is undefined, default to document.URL */ + if(finalPayload.pageUrl === undefined) { + finalPayload.pageUrl = document.URL; + } + + /** If referrerUrl is undefined, default to document.referrer */ + if(finalPayload.referrerUrl === undefined) { + finalPayload.referrerUrl = document.referrer; + } + /** If useBeacon returns false, use postWithFetch. If result is successful, return result json. If request fails, return errors. */ diff --git a/src/EventPayload.ts b/src/EventPayload.ts index 397db81..38d3431 100644 --- a/src/EventPayload.ts +++ b/src/EventPayload.ts @@ -119,15 +119,11 @@ export interface EventPayload { }; /** The URL of the page where the event occurred. * - * If not specified the system will automatically - * use the `Referrer` header from the autogenerated request headers. - */ + * If not specified the system will automatically use document.URL */ pageUrl?: string; /** The URL of the page which the visitor came from prior to the event. * - * If not specified the system will automatically - * use the `Referrer` header from the autogenerated request headers. - */ + * If not specified the system will automatically use document.referrer */ referrerUrl?: string; /** Fields specific to reporting Yext Search Analytics Events */ search?: { diff --git a/tests/AnalyticsEventReporter.test.ts b/tests/AnalyticsEventReporter.test.ts index 9440960..469dc32 100644 --- a/tests/AnalyticsEventReporter.test.ts +++ b/tests/AnalyticsEventReporter.test.ts @@ -118,7 +118,7 @@ describe('Test report function', () => { action: 'C_CUSTOM_ACTION', authorization: 'KEY validKey', clientSdk: { - ANALYTICS: '1.0.2' + ANALYTICS: '1.0.3' }, referrerUrl: 'https://yext.com', destinationUrl: 'https://google.com', @@ -162,7 +162,7 @@ describe('Test report function', () => { action: 'c_lowercase_custom_action', authorization: 'Bearer bearerToken', clientSdk: { - ANALYTICS: '1.0.2' + ANALYTICS: '1.0.3' }, destinationUrl: 'https://google.com', count: 5 @@ -217,7 +217,7 @@ describe('Test report function', () => { action: 'ADD_TO_CART', authorization: 'Bearer bearerToken', clientSdk: { - ANALYTICS: '1.0.2', + ANALYTICS: '1.0.3', chat: '1.0.1.0' }, destinationUrl: 'https://google.com', @@ -274,7 +274,7 @@ describe('Test report function', () => { action: 'ADD_TO_CART', authorization: 'Bearer bearerToken', clientSdk: { - ANALYTICS: '1.0.2', + ANALYTICS: '1.0.3', chat: '1.0.1.0' }, destinationUrl: 'https://google.com', @@ -328,7 +328,7 @@ describe('Test report function', () => { action: 'ADD_TO_CART', authorization: 'Bearer bearerToken', clientSdk: { - ANALYTICS: '1.0.2', + ANALYTICS: '1.0.3', chat: '1.0.1.0' }, destinationUrl: 'https://google.com', @@ -378,7 +378,7 @@ describe('Test report function', () => { action: 'ADD_TO_CART', authorization: 'KEY validKey', clientSdk: { - ANALYTICS: '1.0.2' + ANALYTICS: '1.0.3' }, referrerUrl: 'https://yext.com', count: 5 @@ -426,7 +426,7 @@ describe('Test report function', () => { action: 'ADD_TO_CART', authorization: 'KEY validKey', clientSdk: { - ANALYTICS: '1.0.2' + ANALYTICS: '1.0.3' }, referrerUrl: 'https://yext.com', count: 5 @@ -469,7 +469,7 @@ describe('Test report function', () => { { authorization: 'KEY validKey', clientSdk: { - ANALYTICS: '1.0.2' + ANALYTICS: '1.0.3' } }, config @@ -508,7 +508,7 @@ describe('Test report function', () => { { authorization: 'KEY validKey', clientSdk: { - ANALYTICS: '1.0.2' + ANALYTICS: '1.0.3' } }, config @@ -551,7 +551,7 @@ describe('Test report function', () => { action: 'ADD_TO_CART', authorization: 'KEY validKey', clientSdk: { - ANALYTICS: '1.0.2' + ANALYTICS: '1.0.3' }, referrerUrl: 'https://yext.com', count: 5 @@ -582,7 +582,7 @@ describe('Test report function', () => { action: 'APPLY', authorization: 'KEY validKey', clientSdk: { - ANALYTICS: '1.0.2', + ANALYTICS: '1.0.3', chat: '1.0.1.0' }, destinationUrl: 'https://google.com', @@ -710,7 +710,7 @@ describe('Test report function', () => { responseId: 'responseId' }, clientSdk: { - ANALYTICS: '1.0.2', + ANALYTICS: '1.0.3', chat: '1.0.0' }, count: 5, From 0d8ea44248d67f3aadf4ca7aee48b10122442733 Mon Sep 17 00:00:00 2001 From: Bryan Lee Date: Tue, 8 Apr 2025 14:51:46 -0400 Subject: [PATCH 2/6] EventsSDK: fix formatting and test errors --- src/AnalyticsEventReporter.ts | 4 ++-- tests/AnalyticsEventReporter.test.ts | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/AnalyticsEventReporter.ts b/src/AnalyticsEventReporter.ts index fb7bd08..5413636 100644 --- a/src/AnalyticsEventReporter.ts +++ b/src/AnalyticsEventReporter.ts @@ -79,12 +79,12 @@ export class AnalyticsEventReporter implements AnalyticsEventService { } /** If pageUrl is undefined, default to document.URL */ - if(finalPayload.pageUrl === undefined) { + if (finalPayload.pageUrl === undefined) { finalPayload.pageUrl = document.URL; } /** If referrerUrl is undefined, default to document.referrer */ - if(finalPayload.referrerUrl === undefined) { + if (finalPayload.referrerUrl === undefined) { finalPayload.referrerUrl = document.referrer; } diff --git a/tests/AnalyticsEventReporter.test.ts b/tests/AnalyticsEventReporter.test.ts index 469dc32..a0b0333 100644 --- a/tests/AnalyticsEventReporter.test.ts +++ b/tests/AnalyticsEventReporter.test.ts @@ -153,7 +153,7 @@ describe('Test report function', () => { // Expect Successful Response expect(res).toEqual({ id: 1111 }); - /** Expect merge to have completed correctly (with referrerUrl being removed), + /** Expect merge to have completed correctly, * the url to be constructed correctly defaulting to US, * and the clientSdk and authorization to be added to the request body in the correct format. **/ expect(mockPostWithFetch).toHaveBeenCalledWith( @@ -165,7 +165,10 @@ describe('Test report function', () => { ANALYTICS: '1.0.3' }, destinationUrl: 'https://google.com', - count: 5 + pageUrl: "http://localhost/", + referrerUrl: "", + count: 5, + sessionId: undefined }, config ); @@ -221,6 +224,7 @@ describe('Test report function', () => { chat: '1.0.1.0' }, destinationUrl: 'https://google.com', + pageUrl: "http://localhost/", referrerUrl: 'https://yext.com', count: 5, sessionId: 'ULID1234' @@ -278,6 +282,7 @@ describe('Test report function', () => { chat: '1.0.1.0' }, destinationUrl: 'https://google.com', + pageUrl: "http://localhost/", referrerUrl: 'https://yext.com', count: 5, sessionId: 'ULIDORIGINAL' @@ -332,6 +337,7 @@ describe('Test report function', () => { chat: '1.0.1.0' }, destinationUrl: 'https://google.com', + pageUrl: "http://localhost/", referrerUrl: 'https://yext.com', count: 5, sessionId: undefined @@ -470,7 +476,10 @@ describe('Test report function', () => { authorization: 'KEY validKey', clientSdk: { ANALYTICS: '1.0.3' - } + }, + pageUrl: "http://localhost/", + referrerUrl: "", + sessionId: undefined }, config ); From 5d724abdba99f206477b3c9e09df152e3f7f59e5 Mon Sep 17 00:00:00 2001 From: Bryan Lee Date: Tue, 8 Apr 2025 15:23:32 -0400 Subject: [PATCH 3/6] EventsSDK: fix formatting with Prettier --- tests/AnalyticsEventReporter.test.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/AnalyticsEventReporter.test.ts b/tests/AnalyticsEventReporter.test.ts index a0b0333..78baf4b 100644 --- a/tests/AnalyticsEventReporter.test.ts +++ b/tests/AnalyticsEventReporter.test.ts @@ -165,8 +165,8 @@ describe('Test report function', () => { ANALYTICS: '1.0.3' }, destinationUrl: 'https://google.com', - pageUrl: "http://localhost/", - referrerUrl: "", + pageUrl: 'http://localhost/', + referrerUrl: '', count: 5, sessionId: undefined }, @@ -224,7 +224,7 @@ describe('Test report function', () => { chat: '1.0.1.0' }, destinationUrl: 'https://google.com', - pageUrl: "http://localhost/", + pageUrl: 'http://localhost/', referrerUrl: 'https://yext.com', count: 5, sessionId: 'ULID1234' @@ -282,7 +282,7 @@ describe('Test report function', () => { chat: '1.0.1.0' }, destinationUrl: 'https://google.com', - pageUrl: "http://localhost/", + pageUrl: 'http://localhost/', referrerUrl: 'https://yext.com', count: 5, sessionId: 'ULIDORIGINAL' @@ -337,7 +337,7 @@ describe('Test report function', () => { chat: '1.0.1.0' }, destinationUrl: 'https://google.com', - pageUrl: "http://localhost/", + pageUrl: 'http://localhost/', referrerUrl: 'https://yext.com', count: 5, sessionId: undefined @@ -477,8 +477,8 @@ describe('Test report function', () => { clientSdk: { ANALYTICS: '1.0.3' }, - pageUrl: "http://localhost/", - referrerUrl: "", + pageUrl: 'http://localhost/', + referrerUrl: '', sessionId: undefined }, config From 9876fe6cc1edb8c135e361bd286769180977622f Mon Sep 17 00:00:00 2001 From: Bryan Lee Date: Tue, 8 Apr 2025 17:41:42 -0400 Subject: [PATCH 4/6] EventsSDK: check defaults are not empty strings --- src/AnalyticsEventReporter.ts | 8 ++++---- tests/AnalyticsEventReporter.test.ts | 4 +--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/AnalyticsEventReporter.ts b/src/AnalyticsEventReporter.ts index 5413636..2d4b2be 100644 --- a/src/AnalyticsEventReporter.ts +++ b/src/AnalyticsEventReporter.ts @@ -78,13 +78,13 @@ export class AnalyticsEventReporter implements AnalyticsEventService { }); } - /** If pageUrl is undefined, default to document.URL */ - if (finalPayload.pageUrl === undefined) { + /** If pageUrl is undefined, default to document.URL if it exists */ + if (finalPayload.pageUrl === undefined && document.URL !== '') { finalPayload.pageUrl = document.URL; } - /** If referrerUrl is undefined, default to document.referrer */ - if (finalPayload.referrerUrl === undefined) { + /** If referrerUrl is undefined, default to document.referrer if it exists */ + if (finalPayload.referrerUrl === undefined && document.referrer !== '') { finalPayload.referrerUrl = document.referrer; } diff --git a/tests/AnalyticsEventReporter.test.ts b/tests/AnalyticsEventReporter.test.ts index 78baf4b..b00445c 100644 --- a/tests/AnalyticsEventReporter.test.ts +++ b/tests/AnalyticsEventReporter.test.ts @@ -153,7 +153,7 @@ describe('Test report function', () => { // Expect Successful Response expect(res).toEqual({ id: 1111 }); - /** Expect merge to have completed correctly, + /** Expect merge to have completed correctly (with referrerUrl being removed), * the url to be constructed correctly defaulting to US, * and the clientSdk and authorization to be added to the request body in the correct format. **/ expect(mockPostWithFetch).toHaveBeenCalledWith( @@ -166,7 +166,6 @@ describe('Test report function', () => { }, destinationUrl: 'https://google.com', pageUrl: 'http://localhost/', - referrerUrl: '', count: 5, sessionId: undefined }, @@ -478,7 +477,6 @@ describe('Test report function', () => { ANALYTICS: '1.0.3' }, pageUrl: 'http://localhost/', - referrerUrl: '', sessionId: undefined }, config From f1ad2d1d6f93832bd688006358794139a1b0d1b8 Mon Sep 17 00:00:00 2001 From: Bryan Lee Date: Tue, 22 Apr 2025 16:39:24 -0400 Subject: [PATCH 5/6] EventsSDK: add test and update version --- package-lock.json | 4 +- package.json | 2 +- test-site/package-lock.json | 2 +- tests/AnalyticsEventReporter.test.ts | 84 ++++++++++++++++++++++++---- 4 files changed, 76 insertions(+), 16 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6f1fd04..3fd7944 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@yext/analytics", - "version": "1.0.2", + "version": "1.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@yext/analytics", - "version": "1.0.2", + "version": "1.1.0", "license": "BSD-3-Clause", "dependencies": { "ulidx": "^2.0.0" diff --git a/package.json b/package.json index ffaf088..9c75631 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@yext/analytics", - "version": "1.0.3", + "version": "1.1.0", "description": "An analytics library for Yext", "author": "fusion@yext.com", "license": "BSD-3-Clause", diff --git a/test-site/package-lock.json b/test-site/package-lock.json index 15bf78e..7f2c78a 100644 --- a/test-site/package-lock.json +++ b/test-site/package-lock.json @@ -23,7 +23,7 @@ }, "..": { "name": "@yext/analytics", - "version": "1.0.2", + "version": "1.1.0", "license": "BSD-3-Clause", "dependencies": { "ulidx": "^2.0.0" diff --git a/tests/AnalyticsEventReporter.test.ts b/tests/AnalyticsEventReporter.test.ts index b00445c..ae0d818 100644 --- a/tests/AnalyticsEventReporter.test.ts +++ b/tests/AnalyticsEventReporter.test.ts @@ -118,7 +118,7 @@ describe('Test report function', () => { action: 'C_CUSTOM_ACTION', authorization: 'KEY validKey', clientSdk: { - ANALYTICS: '1.0.3' + ANALYTICS: '1.1.0' }, referrerUrl: 'https://yext.com', destinationUrl: 'https://google.com', @@ -162,7 +162,7 @@ describe('Test report function', () => { action: 'c_lowercase_custom_action', authorization: 'Bearer bearerToken', clientSdk: { - ANALYTICS: '1.0.3' + ANALYTICS: '1.1.0' }, destinationUrl: 'https://google.com', pageUrl: 'http://localhost/', @@ -174,6 +174,66 @@ describe('Test report function', () => { } ); + it('should default pageUrl and referrerUrl to document values if undefined', async () => { + mockPostWithFetch.mockResolvedValue({ id: 2222 }); + mockUseBeacon.mockReturnValueOnce(false); + + const originalURL = document.URL; + const originalReferrer = document.referrer; + + Object.defineProperty(document, 'URL', { + value: 'https://default-url.com', + configurable: true + }); + + Object.defineProperty(document, 'referrer', { + value: 'https://referrer-site.com', + configurable: true + }); + + const config: AnalyticsConfig = { + authorizationType: 'bearer', + authorization: 'bearerToken', + forceFetch: true + }; + + const reporter = new AnalyticsEventReporter(config).with({ + action: 'ADD_TO_CART', + count: 1 + }); + + const res = await reporter.report({}); + + expect(res).toEqual({ id: 2222 }); + + expect(mockPostWithFetch).toHaveBeenCalledWith( + 'https://us.yextevents.com/accounts/me/events', + expect.objectContaining({ + action: 'ADD_TO_CART', + pageUrl: 'https://default-url.com', + referrerUrl: 'https://referrer-site.com', + authorization: 'Bearer bearerToken', + clientSdk: { + ANALYTICS: '1.1.0' + }, + count: 1, + sessionId: undefined + }), + config + ); + + // Reset to not affect other tests + Object.defineProperty(document, 'URL', { + value: originalURL, + configurable: true + }); + + Object.defineProperty(document, 'referrer', { + value: originalReferrer, + configurable: true + }); + }); + it('call post with correct fields, report return error json if post returns an error', async () => { const mockSetupSessionId = getOrSetupSessionId as jest.MockedFunction< typeof getOrSetupSessionId @@ -219,7 +279,7 @@ describe('Test report function', () => { action: 'ADD_TO_CART', authorization: 'Bearer bearerToken', clientSdk: { - ANALYTICS: '1.0.3', + ANALYTICS: '1.1.0', chat: '1.0.1.0' }, destinationUrl: 'https://google.com', @@ -277,7 +337,7 @@ describe('Test report function', () => { action: 'ADD_TO_CART', authorization: 'Bearer bearerToken', clientSdk: { - ANALYTICS: '1.0.3', + ANALYTICS: '1.1.0', chat: '1.0.1.0' }, destinationUrl: 'https://google.com', @@ -332,7 +392,7 @@ describe('Test report function', () => { action: 'ADD_TO_CART', authorization: 'Bearer bearerToken', clientSdk: { - ANALYTICS: '1.0.3', + ANALYTICS: '1.1.0', chat: '1.0.1.0' }, destinationUrl: 'https://google.com', @@ -383,7 +443,7 @@ describe('Test report function', () => { action: 'ADD_TO_CART', authorization: 'KEY validKey', clientSdk: { - ANALYTICS: '1.0.3' + ANALYTICS: '1.1.0' }, referrerUrl: 'https://yext.com', count: 5 @@ -431,7 +491,7 @@ describe('Test report function', () => { action: 'ADD_TO_CART', authorization: 'KEY validKey', clientSdk: { - ANALYTICS: '1.0.3' + ANALYTICS: '1.1.0' }, referrerUrl: 'https://yext.com', count: 5 @@ -474,7 +534,7 @@ describe('Test report function', () => { { authorization: 'KEY validKey', clientSdk: { - ANALYTICS: '1.0.3' + ANALYTICS: '1.1.0' }, pageUrl: 'http://localhost/', sessionId: undefined @@ -515,7 +575,7 @@ describe('Test report function', () => { { authorization: 'KEY validKey', clientSdk: { - ANALYTICS: '1.0.3' + ANALYTICS: '1.1.0' } }, config @@ -558,7 +618,7 @@ describe('Test report function', () => { action: 'ADD_TO_CART', authorization: 'KEY validKey', clientSdk: { - ANALYTICS: '1.0.3' + ANALYTICS: '1.1.0' }, referrerUrl: 'https://yext.com', count: 5 @@ -589,7 +649,7 @@ describe('Test report function', () => { action: 'APPLY', authorization: 'KEY validKey', clientSdk: { - ANALYTICS: '1.0.3', + ANALYTICS: '1.1.0', chat: '1.0.1.0' }, destinationUrl: 'https://google.com', @@ -717,7 +777,7 @@ describe('Test report function', () => { responseId: 'responseId' }, clientSdk: { - ANALYTICS: '1.0.3', + ANALYTICS: '1.1.0', chat: '1.0.0' }, count: 5, From 53a099f0c7a67f29cc3df27e663435b83f11a026 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 22 Apr 2025 20:42:35 +0000 Subject: [PATCH 6/6] Automated update to repo's documentation from github action --- docs/analytics.eventpayload.md | 4 ++-- docs/analytics.eventpayload.pageurl.md | 2 +- docs/analytics.eventpayload.referrerurl.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/analytics.eventpayload.md b/docs/analytics.eventpayload.md index 5082632..f450a50 100644 --- a/docs/analytics.eventpayload.md +++ b/docs/analytics.eventpayload.md @@ -33,8 +33,8 @@ export interface EventPayload | [locale?](./analytics.eventpayload.locale.md) | | string |

_(Optional)_ The locale of the user who generated the event.

If not specified the system will automatically determine the locale from the autogenerated Accept-Language header.

| | [location?](./analytics.eventpayload.location.md) | | Coordinates \| string |

_(Optional)_ The location information of the visitor for the event. Either a Coordinates object with both latitude and longitude or a string with the country of the visitor for the event, as a ISO 3166-1 alpha-2 country code. For more information see https://www.iso.org/iso-3166-country-codes.html.

If not specified the system will automatically determine all location information from the request's IP address, or the value of the ip property if specified.

| | [pages?](./analytics.eventpayload.pages.md) | | { scope?: string; originalEventName?: string; siteUid?: number; template?: string; } | _(Optional)_ Fields specific to reporting Yext Pages Analytics Events | -| [pageUrl?](./analytics.eventpayload.pageurl.md) | | string |

_(Optional)_ The URL of the page where the event occurred.

If not specified the system will automatically use the Referrer header from the autogenerated request headers.

| -| [referrerUrl?](./analytics.eventpayload.referrerurl.md) | | string |

_(Optional)_ The URL of the page which the visitor came from prior to the event.

If not specified the system will automatically use the Referrer header from the autogenerated request headers.

| +| [pageUrl?](./analytics.eventpayload.pageurl.md) | | string |

_(Optional)_ The URL of the page where the event occurred.

If not specified the system will automatically use document.URL

| +| [referrerUrl?](./analytics.eventpayload.referrerurl.md) | | string |

_(Optional)_ The URL of the page which the visitor came from prior to the event.

If not specified the system will automatically use document.referrer

| | [search?](./analytics.eventpayload.search.md) | | { searchId?: string; queryId?: string; verticalKey?: string; isDirectAnswer?: boolean; versionLabel?: [VersionLabel](./analytics.versionlabel.md); versionNumber?: number; experienceKey: string; isGenerativeDirectAnswer?: boolean; } | _(Optional)_ Fields specific to reporting Yext Search Analytics Events | | [searchTerm?](./analytics.eventpayload.searchterm.md) | | string | _(Optional)_ The query entered by the user. | | [sessionId?](./analytics.eventpayload.sessionid.md) | | string \| null | _(Optional)_ Unique identifier to tie together events in a single browsing session | diff --git a/docs/analytics.eventpayload.pageurl.md b/docs/analytics.eventpayload.pageurl.md index 0b0535f..d7cf63f 100644 --- a/docs/analytics.eventpayload.pageurl.md +++ b/docs/analytics.eventpayload.pageurl.md @@ -6,7 +6,7 @@ The URL of the page where the event occurred. -If not specified the system will automatically use the `Referrer` header from the autogenerated request headers. +If not specified the system will automatically use document.URL **Signature:** diff --git a/docs/analytics.eventpayload.referrerurl.md b/docs/analytics.eventpayload.referrerurl.md index 904a99e..0bc97f9 100644 --- a/docs/analytics.eventpayload.referrerurl.md +++ b/docs/analytics.eventpayload.referrerurl.md @@ -6,7 +6,7 @@ The URL of the page which the visitor came from prior to the event. -If not specified the system will automatically use the `Referrer` header from the autogenerated request headers. +If not specified the system will automatically use document.referrer **Signature:**