Commit 768d0801 authored by Axel García's avatar Axel García

Do not append hash to pseudonymized URL

Changelog: other
MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/71335
parent c9555383
...@@ -177,9 +177,12 @@ export default class Tracking { ...@@ -177,9 +177,12 @@ export default class Tracking {
} }
const referrers = getReferrersCache(); 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); window.snowplow('setCustomUrl', pageLinks.url);
if (document.referrer) { if (document.referrer) {
......
...@@ -332,14 +332,13 @@ describe('Tracking', () => { ...@@ -332,14 +332,13 @@ describe('Tracking', () => {
}); });
}); });
it('appends the hash/fragment to the pseudonymized URL', () => { it('does not appends the hash/fragment to the pseudonymized URL', () => {
const hash = 'first-heading';
window.gl.snowplowPseudonymizedPageUrl = TEST_HOST; window.gl.snowplowPseudonymizedPageUrl = TEST_HOST;
window.location.hash = hash; window.location.hash = 'first-heading';
Tracking.setAnonymousUrls(); Tracking.setAnonymousUrls();
expect(snowplowSpy).toHaveBeenCalledWith('setCustomUrl', `${TEST_HOST}#${hash}`); expect(snowplowSpy).toHaveBeenCalledWith('setCustomUrl', TEST_HOST);
}); });
it('does not set the referrer URL by default', () => { 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