Created
June 12, 2017 19:32
-
-
Save WesleyDRobinson/b060a28c72d28c329ed9f0dac732e2ac to your computer and use it in GitHub Desktop.
passing user traits in a track event context object
This file contains 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
// protect 'user' methods from invoking before library is available: https://segment.com/docs/sources/website/analytics.js/#ready | |
analytics.ready(function () { | |
// retrieve user Traits: https://segment.com/docs/sources/website/analytics.js/#user-group-information | |
var userTraits = analytics.user().traits(); | |
// invoke Track method: https://segment.com/docs/sources/website/analytics.js/#track | |
analytics.track('Event Triggered', {eventProp: 1}, {traits: userTraits}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment