зеркало из https://github.com/github/docs.git
Add `hostname` to events (#16419)
...so that its easier to filter out localhost and herokuapp domains
This commit is contained in:
Родитель
db4fad8670
Коммит
714ca0263b
|
@ -63,6 +63,7 @@ export function sendEvent ({
|
|||
|
||||
// Content information
|
||||
path: location.pathname,
|
||||
hostname: location.hostname,
|
||||
referrer: document.referrer,
|
||||
search: location.search,
|
||||
href: location.href,
|
||||
|
|
|
@ -39,6 +39,11 @@ const context = {
|
|||
description: 'The browser value of `location.pathname`.',
|
||||
format: 'uri-reference'
|
||||
},
|
||||
hostname: {
|
||||
type: 'string',
|
||||
description: 'The browser value of `location.hostname.`',
|
||||
format: 'uri-reference'
|
||||
},
|
||||
referrer: {
|
||||
type: 'string',
|
||||
description: 'The browser value of `document.referrer`.',
|
||||
|
|
|
@ -48,6 +48,7 @@ describe('POST /events', () => {
|
|||
|
||||
// Content information
|
||||
path: '/github/docs/issues',
|
||||
hostname: 'github.com',
|
||||
referrer: 'https://github.com/github/docs',
|
||||
search: '?q=is%3Aissue+is%3Aopen+example+',
|
||||
href: 'https://github.com/github/docs/issues?q=is%3Aissue+is%3Aopen+example+',
|
||||
|
@ -138,6 +139,16 @@ describe('POST /events', () => {
|
|||
}, 400)
|
||||
)
|
||||
|
||||
it('should hostname be uri-reference', () =>
|
||||
checkEvent({
|
||||
...pageExample,
|
||||
context: {
|
||||
...pageExample.context,
|
||||
hostname: ' '
|
||||
}
|
||||
}, 400)
|
||||
)
|
||||
|
||||
it('should referrer be uri-reference', () =>
|
||||
checkEvent({
|
||||
...pageExample,
|
||||
|
|
Загрузка…
Ссылка в новой задаче