Commit b5d6d411 authored by Phil Hughes's avatar Phil Hughes

Merge branch '341882-remove-anchors-hashes-in-snowplow-events-urls' into 'master'

Remove anchors/hashes in Snowplow events URLs

See merge request gitlab-org/gitlab!71335
parents 018e51a2 768d0801
......@@ -177,9 +177,12 @@ export default class Tracking {
}
const referrers = getReferrersCache();
const pageLinks = Object.seal({ url: '', referrer: '', originalUrl: window.location.href });
const pageLinks = Object.seal({
url: pageUrl,
referrer: '',
originalUrl: window.location.href,
});
pageLinks.url = `${pageUrl}${window.location.hash}`;
window.snowplow('setCustomUrl', pageLinks.url);
if (document.referrer) {
......
......@@ -332,14 +332,13 @@ describe('Tracking', () => {
});
});
it('appends the hash/fragment to the pseudonymized URL', () => {
const hash = 'first-heading';
it('does not appends the hash/fragment to the pseudonymized URL', () => {
window.gl.snowplowPseudonymizedPageUrl = TEST_HOST;
window.location.hash = hash;
window.location.hash = 'first-heading';
Tracking.setAnonymousUrls();
expect(snowplowSpy).toHaveBeenCalledWith('setCustomUrl', `${TEST_HOST}#${hash}`);
expect(snowplowSpy).toHaveBeenCalledWith('setCustomUrl', TEST_HOST);
});
it('does not set the referrer URL by default', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment