Skip to content

Commit

Permalink
Merge pull request #386 from wdwatkins/master
Browse files Browse the repository at this point in the history
customizing GA tracking snippet so custom dims start with values
  • Loading branch information
aappling-usgs authored Jul 20, 2018
2 parents 20bf560 + 25e7e11 commit 5338518
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions inst/templates/fullPage.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,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
});
</script>
{{/analytics-id}}
Expand Down

0 comments on commit 5338518

Please sign in to comment.