Skip to content

Instantly share code, notes, and snippets.

@jfeldstein
Last active December 17, 2015 14:39
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 jfeldstein/5625577 to your computer and use it in GitHub Desktop.
Save jfeldstein/5625577 to your computer and use it in GitHub Desktop.
Tracking an event with Segment IO, and displaying a chart of each user's usage stats to that user.
// Add the following line:
//= require ./keentivate/index.js
// Before the line:
//= require_tree .
<div class="keentivate"
data-keen-type="line"
data-keen-event="Used Feature X"
data-keen-title="Your Usage of Feature X"
data-keen-filter="userId=<%= @user.id %>"
>
</div>
//= require keentivate.min.js
//= require initialize.js
var keenCharts = new keentivate({
projectId: "50f9e…000000",
readKey: "b26ea03…3ed44c"
},
{
keenClass: "keentivate"
}
);
Analytics.track({
:user_id => @user.id,
:event => 'Used Feature X',
:properties => {
:anything_else => "About this event"
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment