Last active
August 29, 2015 14:05
-
-
Save Radagaisus/c04d7b93c54f4779246c to your computer and use it in GitHub Desktop.
Tracking a user page read action
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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