Created
August 16, 2016 15:33
-
-
Save edwardsfriedman/17a66e22e5f5b81bf4e4470e9ce26f29 to your computer and use it in GitHub Desktop.
Heap super property implementation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%# Enables heap super properties so heap will send properties even when called before it has loaded. %> | |
window.heap = window.heap || []; for (var n = ["clearEventProperties", "removeEventProperty", "addEventProperties", "setEventProperties", "unsetEventProperty", "addUserProperties", "identify", "track"], o = function(e) { return function() { window.heap.push([e].concat(Array.prototype.slice.call(arguments, 0))) }}, t = 0; t < n.length; t++) { var r = n[t]; window.heap[r] = o(r)}; | |
var locale = "<%= I18n.locale %>" | |
<%# Set locale as heap super property. %> | |
window.heap.addUserProperties({ locale: locale }); | |
analytics.load("<%= segment_key %>"); | |
analytics.track('Set Locale', {locale: locale}); | |
//etc etc, with analytics.page() coming below |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment