PageSourceSearch

https://www.elle.cz/js/modules/seznamSessionShare.js

js elle.cz collected 2026-10-02 07:55:40 UTC 2,606 bytes, 80 lines download raw bytes

1// Seznam traffic source identification (since 1. 6. 2026):
2//   utm_source=www.seznam.cz & utm_medium=seznam_distribuce, channel in utm_campaign.
3// When a visitor arrives from Seznam, links pointing to other partner (EOM) domains
4// are decorated with the new UTM params + szn-session = source domain hostname so the
5// attribution and cross-domain session carry over.
6// See https://ssp.seznam.cz/static/doc/technical/#m%C3%A1te-obsah-na-v%C3%ADce-dom%C3%A9n%C3%A1ch-session-p%C5%99i-p%C5%99echodech-mezi-dom%C3%A9nami
7
8const SEZNAM_UTM_SOURCE = 'www.seznam.cz';
9const SEZNAM_UTM_MEDIUM = 'seznam_distribuce';
10const SESSION_COOKIE_NAME = 'im3-seznam-session';
11const CAMPAIGN_COOKIE_NAME = 'szn-session-campaign';
12const DEFAULT_CAMPAIGN = 'hp_feed';
13
14const PARTNER_DOMAINS = [
15  'marianne.cz',
16  'svetzeny.cz',
17  'damske.cz',
18  'extra.cz',
19  'g.cz',
20  'lifee.cz',
21  'extralife.cz',
22  'extrastory.cz',
23  'toprecepty.cz',
24  'onetv.cz'
25];
26
27export function initSeznamSessionShare() {
28  if (!isSeznamSession()) {
29    return;
30  }
31
32  // Channel: URL utm_campaign, then the persisted session cookie, then the default fallback
33  // (on cookie-based detection the original utm_campaign is no longer on the URL).
34  const campaign = resolveCampaign();
35  const seznamParams =
36    `utm_source=${SEZNAM_UTM_SOURCE}&utm_medium=${SEZNAM_UTM_MEDIUM}` +
37    `&utm_campaign=${encodeURIComponent(campaign)}` +
38    `&szn-session=${encodeURIComponent(location.hostname)}`;
39
40  document.querySelectorAll('a[href]').forEach((link) => {
41    const href = link.getAttribute('href');
42    if (!href || href.includes(location.host)) {
43      return;
44    }
45
46    if (PARTNER_DOMAINS.some((domain) => href.includes(domain))) {
47      link.setAttribute('href', href + (href.indexOf('?') !== -1 ? '&' : '?') + seznamParams);
48    }
49  });
50}
51
52function isSeznamSession() {
53  if (/Googlebot/i.test(navigator.userAgent || '')) {
54    return false;
55  }
56
57  const params = new URLSearchParams(location.search);
58  if (params.get('utm_source') === SEZNAM_UTM_SOURCE && params.get('utm_medium') === SEZNAM_UTM_MEDIUM) {
59    return true;
60  }
61
62  return document.cookie
63    .split('; ')
64    .some((entry) => entry === `${SESSION_COOKIE_NAME}=true`);
65}
66
67function resolveCampaign() {
68  const fromUrl = new URLSearchParams(location.search).get('utm_campaign');
69  if (fromUrl) {
70    return fromUrl;
71  }
72
73  const fromCookie = readCookie(CAMPAIGN_COOKIE_NAME);
74  return fromCookie || DEFAULT_CAMPAIGN;
75}
76
77function readCookie(name) {
78  const match = document.cookie.match(new RegExp(`(?:^|; )${name}=([^;]*)`));
79  return match ? decodeURIComponent(match[1]) : '';
80}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.