Skip to content

Instantly share code, notes, and snippets.

@gooley
Last active August 29, 2015 14:03
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 gooley/2e01202c3c6214c66c56 to your computer and use it in GitHub Desktop.
Save gooley/2e01202c3c6214c66c56 to your computer and use it in GitHub Desktop.
Preact+Segment Client-Side Example
// current_user is your logged-in user object
// current_account is your account object
analytics.identify(current_user.id, {
email : current_user.email,
name : current_user.name
});
analytics.group(current_account.id, {
name: current_account.name,
license_status: current_account.status, // optional
license_mrr: current_account.monthly_rate // optional
});
// example with hard-coded values
analytics.identify("123", {
email : "gooley@preact.com",
name : "Christopher Gooley"
});
analytics.group("55322", {
name: "Preact",
license_status: "paying", // optional
license_mrr: "499" // optional
});
@gooley
Copy link
Author

gooley commented Jul 1, 2014

Identify and Group should be called before you call Track on the page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment