blob: df527e24d93b9f4180c7edca2e12a91d2dbf8850 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import { getCookie } from '~/lib/utils/common_utils';
import { SNOWPLOW_JS_SOURCE, GOOGLE_ANALYTICS_ID_COOKIE_NAME } from './constants';
export default function getStandardContext({ extra = {} } = {}) {
const { schema, data = {} } = { ...window.gl?.snowplowStandardContext };
return {
schema,
data: {
...data,
source: SNOWPLOW_JS_SOURCE,
google_analytics_id: getCookie(GOOGLE_ANALYTICS_ID_COOKIE_NAME) ?? '',
extra: { ...data.extra, ...extra },
},
};
}
|