From e5b139404a4faeeb56ab13104953539641d1e17f Mon Sep 17 00:00:00 2001 From: wdwatkins Date: Thu, 19 Jul 2018 15:57:56 -0500 Subject: [PATCH] set sessionID in tracker snippet so it isn't null --- inst/templates/fullPage.mustache | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/inst/templates/fullPage.mustache b/inst/templates/fullPage.mustache index 1b36b73..3c8e03b 100644 --- a/inst/templates/fullPage.mustache +++ b/inst/templates/fullPage.mustache @@ -20,13 +20,18 @@ window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments)}; gtag('js', new Date()); - + function getTimestamp() {return new Date().getTime().toString()} + function getSessionId() {return new Date().getTime() + '.' + Math.random().toString(36).substring(5)} + var sessionId = getSessionId(); + var timestamp = getTimestamp(); gtag('config', '{{ . }}', { 'custom_map': { 'dimension1': 'clientId', 'dimension2': 'sessionId', 'dimension3': 'timestamp' - } + }, + 'sessionId': sessionId, + 'timestamp': timestamp }); {{/analytics-id}}