Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(function () {
// analytics.js stub
const analytics = window.analytics = {}
const methods = [
'trackSubmit', 'trackClick', 'trackLink', 'trackForm', 'pageview',
'identify', 'reset', 'group', 'track', 'ready', 'alias', 'debug',
'page', 'once', 'off', 'on', 'load'
]
methods.forEach(method =>
analytics[method] = (...args) => console.log(\`analytics.\${method}\`, ...args)
)
})()
`
}
return createSnippet({ apiKey: writeKey, page: false })
}
renderSnippet() {
const opts = {
apiKey: ANALYTICS_WRITE_KEY,
// note: the page option only covers SSR tracking.
// Page.js is used to track other events using `window.analytics.page()`
page: true,
}
if (NODE_ENV === 'development') {
return snippet.max(opts)
}
return snippet.min(opts)
}
export function renderScript() {
const { publicRuntimeConfig: { segmentAnalytics } } = getConfig();
const opts = {
apiKey: segmentAnalytics.writeKey,
page: true // Set this to `false` if you want to manually fire `analytics.page()` from within your pages.
};
if (segmentAnalytics.skipMinimize === true) {
return snippet.max(opts);
}
return snippet.min(opts);
}
export function renderScript() {
const { publicRuntimeConfig: { segmentAnalytics } } = getConfig();
const opts = {
apiKey: segmentAnalytics.writeKey,
page: true // Set this to `false` if you want to manually fire `analytics.page()` from within your pages.
};
if (segmentAnalytics.skipMinimize === true) {
return snippet.max(opts);
}
return snippet.min(opts);
}
renderSnippet() {
const opts = {
apiKey: ANALYTICS_WRITE_KEY,
// note: the page option only covers SSR tracking.
// Page.js is used to track other events using `window.analytics.page()`
page: true,
}
if (NODE_ENV === 'development') {
return snippet.max(opts)
}
return snippet.min(opts)
}