Set up a Snowplow JS tracker for pageviews on GitLab.com
Description
We'd like to use Snowplow for tracking pageviews and events on GitLab.com. In Snowplow, trackers fire events, which are received and logged by collectors. Trackers send data to collectors by making a GET
request for a tracking pixel. This issue sets up these JavaScript trackers on GitLab.com.
This issue is dependent on a collector endpoint, which is being tracked in this TBC issue.
Proposal
In order to follow the asynchronous integration steps in https://github.com/snowplow/snowplow/wiki/integrating-javascript-tags-onto-your-website, we need to be able to install a script into the <head>
for all pages on the GitLab.com instance.
Additional
The script in Snowplow's documentation includes window.snowplow('trackPageView');
, which should yield pageview tracking for all pages on GitLab.com.
Additionally:
- We should self-host our
sp.js
and point to it instead of using Snowplow Analytics' hosted copy. This issue is tracked here https://gitlab.com/gitlab-org/gitlab-ce/issues/47810.- Snowplow's hosted copy is probably OK for testing and staging, but we should probably host our own before this hits production.
Collector endpoint
https://snowplow.trx.gitlab.net
Links / references
- Meta issue for setting up Snowplow on GitLab.com: https://gitlab.com/gitlab-org/gitlab-ee/issues/6329
- Snowplow documentation: https://github.com/snowplow/snowplow/wiki