Add snowplow tracking to streaming audit events tab
What does this MR do and why?
This MR adds a Snowplow tracking event to the audit events streaming tab. Clicking on the tab will trigger a Snowplow event which we will then use to track the user usage of this feature over time.
Screenshots or screen recordings
Screen_Recording_2022-05-11_at_12.37.21
How to set up and validate locally
Snowplow micro
Example output
[
{
"contexts": [
"iglu:com.gitlab/gitlab_standard/jsonschema/1-0-8",
"iglu:com.snowplowanalytics.snowplow/web_page/jsonschema/1-0-0",
"iglu:org.w3/PerformanceTiming/jsonschema/1-0-0"
],
"event": {
"app_id": "gitlab",
"base_currency": null,
"br_colordepth": "24",
"br_cookies": true,
"br_family": null,
"br_features_director": false,
"br_features_flash": false,
"br_features_gears": false,
"br_features_java": false,
"br_features_pdf": true,
"br_features_quicktime": false,
"br_features_realplayer": false,
"br_features_silverlight": false,
"br_features_windowsmedia": false,
"br_lang": "en-GB",
"br_name": null,
"br_renderengine": null,
"br_type": null,
"br_version": null,
"br_viewheight": 943,
"br_viewwidth": 1215,
"collector_tstamp": "2022-05-11T11:33:57.249Z",
"contexts": {
"data": [
{
"data": {
"context_generated_at": "2022-05-11T11:33:46.156Z",
"environment": "development",
"extra": {},
"google_analytics_id": "",
"namespace_id": 22,
"plan": "default",
"project_id": null,
"source": "gitlab-javascript",
"user_id": 1
},
"schema": "iglu:com.gitlab/gitlab_standard/jsonschema/1-0-8"
},
{
"data": {
"id": "0e23693d-f91e-4bff-965f-377161b56a02"
},
"schema": "iglu:com.snowplowanalytics.snowplow/web_page/jsonschema/1-0-0"
},
{
"data": {
"connectEnd": 1652268825315,
"connectStart": 1652268825315,
"domComplete": 1652268829922,
"domContentLoadedEventEnd": 1652268829480,
"domContentLoadedEventStart": 1652268829478,
"domInteractive": 1652268828174,
"domLoading": 1652268827554,
"domainLookupEnd": 1652268825315,
"domainLookupStart": 1652268825315,
"fetchStart": 1652268825315,
"loadEventEnd": 1652268829923,
"loadEventStart": 1652268829922,
"navigationStart": 1652268825312,
"redirectEnd": 0,
"redirectStart": 0,
"requestStart": 1652268825320,
"responseEnd": 1652268827539,
"responseStart": 1652268827538,
"secureConnectionStart": 0,
"unloadEventEnd": 1652268827548,
"unloadEventStart": 1652268827547
},
"schema": "iglu:org.w3/PerformanceTiming/jsonschema/1-0-0"
}
],
"schema": "iglu:com.snowplowanalytics.snowplow/contexts/jsonschema/1-0-0"
},
"derived_contexts": {},
"derived_tstamp": "2022-05-11T11:33:57.248Z",
"doc_charset": "UTF-8",
"doc_height": 943,
"doc_width": 1200,
"domain_sessionid": "a2e33e6b-c2f6-4bcb-8217-4b558f18477f",
"domain_sessionidx": 1,
"domain_userid": "67dad238-eddd-4e77-9a7f-e47b67c09433",
"dvce_created_tstamp": "2022-05-11T11:33:57.220Z",
"dvce_ismobile": null,
"dvce_screenheight": 1080,
"dvce_screenwidth": 3840,
"dvce_sent_tstamp": "2022-05-11T11:33:57.221Z",
"dvce_type": null,
"etl_tags": null,
"etl_tstamp": "2022-05-11T11:33:57.257Z",
"event": "struct",
"event_fingerprint": null,
"event_format": "jsonschema",
"event_id": "c4a15ca1-d9c6-4f9b-8900-ad801cbdc309",
"event_name": "event",
"event_vendor": "com.google.analytics",
"event_version": "1-0-0",
"geo_city": null,
"geo_country": null,
"geo_latitude": null,
"geo_longitude": null,
"geo_region": null,
"geo_region_name": null,
"geo_timezone": null,
"geo_zipcode": null,
"ip_domain": null,
"ip_isp": null,
"ip_netspeed": null,
"ip_organization": null,
"mkt_campaign": null,
"mkt_clickid": null,
"mkt_content": null,
"mkt_medium": null,
"mkt_network": null,
"mkt_source": null,
"mkt_term": null,
"name_tracker": "gl",
"network_userid": "959b9093-9497-489a-bf3c-c61b8ec5ced5",
"os_family": null,
"os_manufacturer": null,
"os_name": null,
"os_timezone": "Europe/London",
"page_referrer": "http://gdk.test:3000/users/sign_in",
"page_title": null,
"page_url": "http://gdk.test:3000/groups/gitlab-org/-/audit_events",
"page_urlfragment": null,
"page_urlhost": "gdk.test",
"page_urlpath": "/groups/gitlab-org/-/audit_events",
"page_urlport": 3000,
"page_urlquery": null,
"page_urlscheme": "http",
"platform": "web",
"pp_xoffset_max": null,
"pp_xoffset_min": null,
"pp_yoffset_max": null,
"pp_yoffset_min": null,
"refr_domain_userid": null,
"refr_dvce_tstamp": null,
"refr_medium": null,
"refr_source": null,
"refr_term": null,
"refr_urlfragment": null,
"refr_urlhost": "gdk.test",
"refr_urlpath": "/users/sign_in",
"refr_urlport": 3000,
"refr_urlquery": null,
"refr_urlscheme": "http",
"se_action": "click_tab",
"se_category": "groups:audit_events:index",
"se_label": "audit_events_streams_tab",
"se_property": null,
"se_value": null,
"ti_category": null,
"ti_currency": null,
"ti_name": null,
"ti_orderid": null,
"ti_price": null,
"ti_price_base": null,
"ti_quantity": null,
"ti_sku": null,
"tr_affiliation": null,
"tr_city": null,
"tr_country": null,
"tr_currency": null,
"tr_orderid": null,
"tr_shipping": null,
"tr_shipping_base": null,
"tr_state": null,
"tr_tax": null,
"tr_tax_base": null,
"tr_total": null,
"tr_total_base": null,
"true_tstamp": null,
"txn_id": null,
"unstruct_event": null,
"user_fingerprint": null,
"user_id": null,
"user_ipaddress": "172.17.0.1",
"useragent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5055.0 Safari/537.36",
"v_collector": "ssc-2.3.0-stdout$",
"v_etl": "snowplow-micro-1.1.3-rc3-common-2.0.1",
"v_tracker": "js-2.17.3"
},
"eventType": "struct",
"rawEvent": {
"api": {
"vendor": "com.snowplowanalytics.snowplow",
"version": "tp2"
},
"contentType": "application/json",
"context": {
"headers": [
"Timeout-Access: <function1>",
"Host: localhost:9091",
"Connection: keep-alive",
"Pragma: no-cache",
"Cache-Control: no-cache",
"sec-ch-ua: \".Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"103\", \"Chromium\";v=\"103\"",
"sec-ch-ua-mobile: ?0",
"User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5055.0 Safari/537.36",
"sec-ch-ua-platform: \"macOS\"",
"Accept: */*",
"Origin: http://gdk.test:3000",
"Sec-Fetch-Site: cross-site",
"Sec-Fetch-Mode: cors",
"Sec-Fetch-Dest: empty",
"Referer: http://gdk.test:3000/",
"Accept-Encoding: gzip, deflate, br",
"Accept-Language: en-GB, en;q=0.9, es-ES;q=0.8, es;q=0.7, en-US;q=0.6",
"application/json"
],
"ipAddress": "172.17.0.1",
"refererUri": "http://gdk.test:3000/",
"timestamp": "2022-05-11T11:33:57.249Z",
"userId": "959b9093-9497-489a-bf3c-c61b8ec5ced5",
"useragent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5055.0 Safari/537.36"
},
"parameters": {
"aid": "gitlab",
"cd": "24",
"cookie": "1",
"cs": "UTF-8",
"cx": "eyJzY2hlbWEiOiJpZ2x1OmNvbS5zbm93cGxvd2FuYWx5dGljcy5zbm93cGxvdy9jb250ZXh0cy9qc29uc2NoZW1hLzEtMC0wIiwiZGF0YSI6W3sic2NoZW1hIjoiaWdsdTpjb20uZ2l0bGFiL2dpdGxhYl9zdGFuZGFyZC9qc29uc2NoZW1hLzEtMC04IiwiZGF0YSI6eyJlbnZpcm9ubWVudCI6ImRldmVsb3BtZW50Iiwic291cmNlIjoiZ2l0bGFiLWphdmFzY3JpcHQiLCJwbGFuIjoiZGVmYXVsdCIsImV4dHJhIjp7fSwidXNlcl9pZCI6MSwibmFtZXNwYWNlX2lkIjoyMiwicHJvamVjdF9pZCI6bnVsbCwiY29udGV4dF9nZW5lcmF0ZWRfYXQiOiIyMDIyLTA1LTExVDExOjMzOjQ2LjE1NloiLCJnb29nbGVfYW5hbHl0aWNzX2lkIjoiIn19LHsic2NoZW1hIjoiaWdsdTpjb20uc25vd3Bsb3dhbmFseXRpY3Muc25vd3Bsb3cvd2ViX3BhZ2UvanNvbnNjaGVtYS8xLTAtMCIsImRhd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
"eid": "c4a15ca1-d9c6-4f9b-8900-ad801cbdc309",
"f_ag": "0",
"f_dir": "0",
"f_fla": "0",
"f_gears": "0",
"f_java": "0",
"f_pdf": "1",
"f_qt": "0",
"f_realp": "0",
"f_wma": "0",
"lang": "en-GB",
"p": "web",
"refr": "http://gdk.test:3000/users/sign_in",
"res": "3840x1080",
"se_ac": "click_tab",
"se_ca": "groups:audit_events:index",
"se_la": "audit_events_streams_tab",
"sid": "a2e33e6b-c2f6-4bcb-8217-4b558f18477f",
"stm": "1652268837221",
"tna": "gl",
"tv": "js-2.17.3",
"tz": "Europe/London",
"url": "http://gdk.test:3000/groups/gitlab-org/-/audit_events",
"vid": "1",
"vp": "1215x943"
},
"source": {
"encoding": "UTF-8",
"hostname": "localhost",
"name": "ssc-2.3.0-stdout$"
}
},
"schema": "iglu:com.google.analytics/event/jsonschema/1-0-0"
}
]
Setup & testing
Note: This feature requires at least GitLab Premium
- Make sure that you disable
Do not track
in your browser, plus any other tracker blockers you might have installed (uBlock, Ghost, PiHole etc) - Enable Snowplow via
[HOST]/admin/application_settings/general#js-snowplow-settings
, you can use the following for testing purposes:
Hostname: your-snowplow-collector.net
App ID: gitlab
Cookie domain: .your-gitlab-instance.com
- Install a browser extension to test the events are sent
- Note: If you do not have Snowplow micro setup you will get multiple events as it tries to resend them
- Visit
[HOST]/groups/[GROUP]/-/audit_events
- Click on the "Streams" tab and check that the Snowplow event is sent with the following info:
Event Category : groups:audit_events:index
Event Action : click_tab
Event Label : audit_events_streams_tab
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #356148 (closed)
Edited by Robert Hunt