Skip to content

Instantly share code, notes, and snippets.

@digitalbase
Created April 21, 2020 10:43
Show Gist options
  • Save digitalbase/669e60a36375dd98ccaf276c23aed9b6 to your computer and use it in GitHub Desktop.
Save digitalbase/669e60a36375dd98ccaf276c23aed9b6 to your computer and use it in GitHub Desktop.
// Once a noteworthy source is identified we fire a tracking call
// spec @ https://segment.com/docs/connections/spec/track/
analytics.track('Visitor Origin Identified`, {
{
"referrer": {
type: "email",
client: "gmail",
from: "https://mail.google.com/",
link: "http://blog.intercom.io/churn-retention-and-reengaging-customers/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+contrast%2Fblog+%28The+Intercom+Blog%29"
},
"campaign": {
source: "feedburner",
medium: "feed",
campaign: "Feed: contrast/blog (The Intercom Blog)"
}
});
// Once in a while we calculate the different models for the user
// spec @ https://segment.com/docs/connections/spec/identify/
analytics.identify(userId, {
first_source_primary: 'email',
first_source_secondary: 'gmail',
last_source_primary: 'paid',
last_source_secondary: 'adwords',
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment