Skip to content

Instantly share code, notes, and snippets.

@hijonathan
Last active May 24, 2016 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hijonathan/61fc42ff55c2d61f2754a5a1e8495e27 to your computer and use it in GitHub Desktop.
Save hijonathan/61fc42ff55c2d61f2754a5a1e8495e27 to your computer and use it in GitHub Desktop.
Using Appcues + Segment with anonymous visitors. This snippet can safely be added to your site via Google Tag Manager.
<script>
(function() {
if (analytics != null && analytics.ready != null) {
analytics.ready(function() {
if (window.Appcues != null) {
if (analytics.user().id()) {
// Identify known user.
Appcues.identify(analytics.user().id(), analytics.user().traits());
} else {
// Identify as an anonymous user.
Appcues.identify(analytics.user().anonymousId())
}
}
})
}
})()
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment