Skip to content

Instantly share code, notes, and snippets.

@Radagaisus
Last active August 29, 2015 14:05
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 Radagaisus/c04d7b93c54f4779246c to your computer and use it in GitHub Desktop.
Save Radagaisus/c04d7b93c54f4779246c to your computer and use it in GitHub Desktop.
Tracking a user page read action
// Asynchronous wrapper around Captain Up, code will run once Captain Up has loaded.
captain.up(function() {
// Periodically test if the user has read the page
setInterval(function(){
// You need to implement `user_read_the_page` by yourself, maybe as a check
// that the user scrolled to the bottom? Or spent at least a minute on the page?
if (user_read_the_page()) {
// Track the action with Captain Up, remember to configure the action settings for it
// by creating a new 'read' action in your admin panel.
captain.action('read', {
entity: {
name: 'The name of the page',
url: 'the url of the page'
}
});
}
}, 1000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment