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

events_tracking.js « error_tracking « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: eb38fe6542b946c068abdab415ea9f853348f257 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import Tracking from '~/tracking';

const category = 'Error Tracking'; // eslint-disable-line @gitlab/require-i18n-strings

function sendTrackingEvents(action, integrated) {
  Tracking.event(category, action, {
    extra: {
      variant: integrated ? 'integrated' : 'external',
    },
  });
}

/**
 * Tracks snowplow event when User clicks on error link to Sentry
 * @param {String}  externalUrl that will be send as a property for the event
 */
export const trackClickErrorLinkToSentryOptions = (url) => ({
  category,
  action: 'click_error_link_to_sentry',
  label: 'Error Link', // eslint-disable-line @gitlab/require-i18n-strings
  property: url,
});

/**
 * Tracks snowplow event when user views error list
 */

export const trackErrorListViewsOptions = (integrated) => {
  sendTrackingEvents('view_errors_list', integrated);
};

/**
 * Tracks snowplow event when user views error details
 */
export const trackErrorDetailsViewsOptions = (integrated) => {
  sendTrackingEvents('view_error_details', integrated);
};

/**
 * Tracks snowplow event when error status is updated
 */
export const trackErrorStatusUpdateOptions = (status, integrated) => {
  sendTrackingEvents(`update_${status}_status`, integrated);
};

/**
 * Tracks snowplow event when error list is filter by status
 */
export const trackErrorStatusFilterOptions = (status, integrated) => {
  sendTrackingEvents(`filter_${status}_status`, integrated);
};

/**
 * Tracks snowplow event when error list is sorted by field
 */
export const trackErrorSortedByField = (field, integrated) => {
  sendTrackingEvents(`sort_by_${field}`, integrated);
};

/**
 * Tracks snowplow event when the Create Issue button is clicked
 */
export const trackCreateIssueFromError = (integrated) => {
  sendTrackingEvents('click_create_issue_from_error', integrated);
};