How to use the @segment/snippet.max function in @segment/snippet

To help you get started, we’ve selected a few @segment/snippet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github reactioncommerce / example-storefront / src / custom / analytics / segment.js View on Github external
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);
}
github zeit / next.js / examples / with-segment-analytics / pages / _document.js View on Github external
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)
  }

@segment/snippet

Templating methods for rendering the analytics.js snippet.

MIT
Latest version published 10 months ago

Package Health Score

67 / 100
Full package analysis

Popular @segment/snippet functions

Similar packages