2021-06-18 20:10:16 -04:00
|
|
|
- return unless Gitlab::Tracking.enabled?
|
2019-08-14 15:21:58 -04:00
|
|
|
|
2022-04-12 08:08:50 -04:00
|
|
|
- namespace = @group || @project&.namespace || @namespace
|
2021-11-22 04:10:28 -05:00
|
|
|
|
2020-11-26 13:09:18 -05:00
|
|
|
= javascript_tag do
|
2019-08-14 15:21:58 -04:00
|
|
|
:plain
|
|
|
|
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
|
|
|
|
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
|
|
|
|
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
|
|
|
|
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","#{asset_url('snowplow/sp.js')}","snowplow"));
|
|
|
|
|
2021-09-09 08:09:09 -04:00
|
|
|
window.snowplowOptions = #{Gitlab::Tracking.options(@group).to_json}
|
2021-02-22 10:10:48 -05:00
|
|
|
|
|
|
|
gl = window.gl || {};
|
2022-08-09 23:11:16 -04:00
|
|
|
gl.snowplowStandardContext = #{Gitlab::Tracking::StandardContext.new(
|
|
|
|
namespace: namespace,
|
|
|
|
project: @project,
|
|
|
|
user: current_user
|
|
|
|
).to_context.to_json.to_json}
|
2021-11-22 04:10:28 -05:00
|
|
|
gl.snowplowPseudonymizedPageUrl = #{masked_page_url(group: namespace, project: @project).to_json};
|