How to use the analytics.js function in analytics

To help you get started, we’ve selected a few analytics 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 dymajo / waka / server-static / defaults.js View on Github external
process.exit(1)
}

const template = {
  layout: pug.compileFile(path.join(__dirname, 'templates/layout.pug')),
}

const dtitle = 'Waka'
const ddescription =
  'Your way around Auckland & Wellington. Realtime, beautiful, and runs on all of your devices.'
const dcanonical = 'https://waka.app'

const defaults = {
  vendorpath: `/${manifest['vendor.js']}`,
  apppath: `/${manifest['app.js']}`,
  analyticspath: `/${manifest['analytics.js']}`,
  csspath: `/${manifest['app.css']}`,
}

const uploadFiles = async () => {
  const client = new Storage({
    backing: process.env.storageService,
    local: false,
    region: process.env.storageRegion,
  })
  const container = process.env.storageContainer

  // we need this so we know what file maps to what key
  // it's 1-1 relationship, so it's okay
  const reverseDefaults = {}
  for (const key in defaults) {
    reverseDefaults[defaults[key]] = key
github prateekbh / Guess / app.js View on Github external
function serveIndex(req,res) {
  const isSafari = /^((?!chrome|android).)*safari/i.test(req.get('User-Agent'));
  if (app.get('env') === 'development') {
    const userCss = fs.readFileSync(__dirname + '/public' + fileRevs['userapp.css'].substr(fileRevs['userapp.css'].indexOf('/')) , 'utf8');
  } else {
    if (req.headers['x-forwarded-proto'] && req.headers['x-forwarded-proto'] !== 'https') {
      return res.redirect('https://' + req.headers.host + req.url);
    }
  }
  const renderOptions = {
    vendorjs: fileRevs['vendor.js'],
    userjs: fileRevs['userapp.js'],
    analyticsjs: fileRevs['analytics.js'],
    usercss: userCss,
  };
  if (isSafari || req.get('User-Agent').indexOf('Edge') !== -1 || req.get('User-Agent').indexOf('Firefox') !== -1) {
    renderOptions.addPolyfill=true;
  }
  res.render('userapp', renderOptions);
}
github dymajo / waka / localserver.js View on Github external
const server = function(req, res) {
  res.send(template({
    title: 'Transit',
    description: 'localhost mode',
    vendorpath: '/' + manifest['vendor.js'],
    apppath: '/' + manifest['app.js'],
    analyticspath: '/' + manifest['analytics.js'],
    csspath: '/' + manifest['app.css']
  }))
}
app.use('/scss', express.static(__dirname + '/scss'))