debian-mirror-gitlab/app/assets/javascripts/tracking/get_standard_context.js

17 lines
489 B
JavaScript
Raw Normal View History

2021-11-18 22:05:49 +05:30
import { getCookie } from '~/lib/utils/common_utils';
import { SNOWPLOW_JS_SOURCE, GOOGLE_ANALYTICS_ID_COOKIE_NAME } from './constants';
2021-09-04 01:27:46 +05:30
export default function getStandardContext({ extra = {} } = {}) {
const { schema, data = {} } = { ...window.gl?.snowplowStandardContext };
return {
schema,
data: {
...data,
source: SNOWPLOW_JS_SOURCE,
2021-11-18 22:05:49 +05:30
google_analytics_id: getCookie(GOOGLE_ANALYTICS_ID_COOKIE_NAME) ?? '',
2021-09-04 01:27:46 +05:30
extra: extra || data.extra,
},
};
}