Welcome to mirror list, hosted at ThFree Co, Russian Federation.

tracker.js « entrypoints « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 91d19d249b314341182854653062631f6ad8213f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import {
  newTracker,
  enableActivityTracking,
  trackPageView,
  setDocumentTitle,
  trackStructEvent,
  setCustomUrl,
  setReferrerUrl,
} from '@snowplow/browser-tracker';
import {
  enableLinkClickTracking,
  LinkClickTrackingPlugin,
} from '@snowplow/browser-plugin-link-click-tracking';
import { enableFormTracking, FormTrackingPlugin } from '@snowplow/browser-plugin-form-tracking';
import { TimezonePlugin } from '@snowplow/browser-plugin-timezone';
import { GaCookiesPlugin } from '@snowplow/browser-plugin-ga-cookies';
import { PerformanceTimingPlugin } from '@snowplow/browser-plugin-performance-timing';
import { ClientHintsPlugin } from '@snowplow/browser-plugin-client-hints';

const SNOWPLOW_ACTIONS = {
  newTracker,
  enableActivityTracking,
  trackPageView,
  setDocumentTitle,
  trackStructEvent,
  enableLinkClickTracking,
  enableFormTracking,
  setCustomUrl,
  setReferrerUrl,
};

window.snowplow = (action, ...config) => {
  if (SNOWPLOW_ACTIONS[action]) {
    SNOWPLOW_ACTIONS[action](...config);
  } else {
    // eslint-disable-next-line no-console, @gitlab/require-i18n-strings
    console.warn('Unsupported snowplow action:', action);
  }
};

window.snowplowPlugins = [
  LinkClickTrackingPlugin(),
  FormTrackingPlugin(),
  TimezonePlugin(),
  GaCookiesPlugin(),
  PerformanceTimingPlugin(),
  ClientHintsPlugin(),
];

export default {};