How to use the analytics-utils.uuid function in analytics-utils

To help you get started, we’ve selected a few analytics-utils 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 DavidWells / analytics / packages / analytics-core / src / modules / context.js View on Github external
let referrer
let locale
let timeZone
if (process.browser) {
  osName = getOSNameBrowser()
  referrer = document.referrer
  locale = getBrowserLocale()
  timeZone = getTimeZone()
} else {
  osName = getOSNameNode()
  referrer = {}
}

const initialState = {
  initialized: false,
  sessionId: uuid(),
  app: null,
  version: null,
  debug: false,
  offline: (inBrowser) ? !navigator.onLine : false, // use node network is-online
  os: {
    name: osName,
  },
  userAgent: (inBrowser) ? navigator.userAgent : 'node', // https://github.com/bestiejs/platform.js
  library: {
    name: 'analytics',
    // TODO fix version number. npm run publish:patch has wrong version
    version: process.env.VERSION
  },
  timezone: timeZone,
  locale: locale,
  campaign: {},
github DavidWells / analytics / packages / analytics-core / src / modules / user.js View on Github external
export function getPersistedUserData(params) {
  return {
    userId: storage.getItem(USER_ID) || params.an_uid,
    anonymousId: storage.getItem(ANON_ID) || params.an_aid || uuid(),
    traits: storage.getItem(USER_TRAITS) || {}
  }
}