Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return {
geo: {
info: { /* Enriched */ },
ip_address: '${keen.ip}',
},
page: {
info: { /* Enriched */ },
title: document.title,
url: document.location.href
},
referrer: {
info: { /* Enriched */ },
url: document.referrer
},
tech: {
browser: Keen.helpers.getBrowserProfile(),
info: { /* Enriched */ },
user_agent: '${keen.user_agent}'
},
time: Keen.helpers.getDatetimeIndex(),
visitor: {
time_on_page: timer.value()
/* Include additional visitor info here */
},
keen: {
addons: [
{
name: 'keen:ip_to_geo',
input: {
ip: 'geo.ip_address'
},
output : 'geo.info'
},
page: {
info: { /* Enriched */ },
title: document.title,
url: document.location.href
},
referrer: {
info: { /* Enriched */ },
url: document.referrer
},
tech: {
browser: Keen.helpers.getBrowserProfile(),
info: { /* Enriched */ },
user_agent: '${keen.user_agent}'
},
time: Keen.helpers.getDatetimeIndex(),
visitor: {
time_on_page: timer.value()
/* Include additional visitor info here */
},
keen: {
addons: [
{
name: 'keen:ip_to_geo',
input: {
ip: 'geo.ip_address'
},
output : 'geo.info'
},
{
name: 'keen:ua_parser',
input: {
);
return {
page: {
title: this.headData.title || document.title,
url: document.URL,
meta: {},
info: {},
},
referrer: {
url: document.referrer,
info: {},
},
time: {
local: KeenTracking.helpers.getDatetimeIndex(now),
utc: KeenTracking.helpers.getDatetimeIndex(nowUTC),
},
node: nodeInfo,
anon: {
id: md5(this.cookies.read(keenSessionIdCookie)),
},
meta: {
epoch: 1, // version of pageview event schema
},
keen: {
addons: [
{
name: 'keen:url_parser',
input: {
url: 'page.url',
},
output: 'page.info',
var node = window.contextVars.node;
var pageMeta = lodashGet(window, 'contextVars.analyticsMeta.pageMeta', {});
return {
page: {
title: document.title,
url: document.URL,
meta: pageMeta,
info: {},
},
referrer: {
url: document.referrer,
info: {},
},
time: {
local: keenTracking.helpers.getDatetimeIndex(),
utc: keenTracking.helpers.getDatetimeIndex(_nowUTC()),
},
node: {
id: lodashGet(node, 'id'),
title: lodashGet(node, 'title'),
type: lodashGet(node, 'category'),
tags: lodashGet(node, 'tags'),
},
anon: {
id: md5(Cookie.get('keenSessionId')),
continent: user.anon.continent,
country: user.anon.country,
},
meta: {
epoch: 1, // version of pageview event schema
},
keen: {
createOrUpdateKeenSession() {
const sessionId = this.cookies.read(keenSessionIdCookie) || KeenTracking.helpers.getUniqueId();
this.cookies.write(
keenSessionIdCookie,
sessionId,
{
expires: moment().add(25, 'minutes').toDate(),
path: '/',
},
);
}
function _createOrUpdateKeenSession() {
var expDate = new Date();
var expiresInMinutes = 25;
expDate.setTime(expDate.getTime() + (expiresInMinutes * 60 * 1000));
var currentSessionId = Cookie.get('keenSessionId') || keenTracking.helpers.getUniqueId();
Cookie.set('keenSessionId', currentSessionId, {expires: expDate, path: '/'});
}