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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/tracking/get_standard_context.js')
-rw-r--r--app/assets/javascripts/tracking/get_standard_context.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/assets/javascripts/tracking/get_standard_context.js b/app/assets/javascripts/tracking/get_standard_context.js
new file mode 100644
index 00000000000..c318029323d
--- /dev/null
+++ b/app/assets/javascripts/tracking/get_standard_context.js
@@ -0,0 +1,14 @@
+import { SNOWPLOW_JS_SOURCE } from './constants';
+
+export default function getStandardContext({ extra = {} } = {}) {
+ const { schema, data = {} } = { ...window.gl?.snowplowStandardContext };
+
+ return {
+ schema,
+ data: {
+ ...data,
+ source: SNOWPLOW_JS_SOURCE,
+ extra: extra || data.extra,
+ },
+ };
+}