The following are some key things to note about the Item page view Javascript event:
- Nearly the same as "Regular Page View" in terms of the code, but just adding one more line in to track the ID of the item the person is looking at.
- This should match the ID of the item passed over from Data feeds.
- This event should fire on any page that is a singular item view.
- e.g. If an item click loads an AJAX pop-up window of the item, you would want to fire this script on that click.
- This event is what enables the "Browse Abandon" stage for users in Cortex.
Item page view event details
The item page view event will be very similar to the regular page view, but specific to item pages. The only difference here will be to add the event specific code.
- The item_id should correspond to the item’s unique record ID within your database.
- Insert this code into the
/*** EVENT SPECIFIC CODE ***/
section:
/*** EVENT SPECIFIC CODE ***/
_rsq.push(['_addItem', {'id': 'item_id'}]); // replace item_id with your dynamic item_id variable
/*** END EVENT SPECIFIC CODE ***/
Item page view code sample
<!-- RetentionScience start -->
<script type='text/javascript'>
var _rsq = _rsq || [];
_rsq.push(['_setSiteId', 'site_id']); // replace site_id with your static Site ID
_rsq.push(['_enableOnsite']);
if (condition) { // replace condition with your parameters for checking if a user is logged in
_rsq.push(['_setUserId', 'user_id']); // replace user_id with your dynamic user_id variable
_rsq.push(['_setUserEmail','user_email']); // replace user_email with your dynamic user_email variable
}
/*** EVENT SPECIFIC CODE ***/
_rsq.push(['_addItem', {'id': 'item_id'}]); // replace item_id with your dynamic item_id variable
/*** END EVENT SPECIFIC CODE ***/
_rsq.push(['_track']);
(function() {
var rScix = document.createElement('script');
rScix.type = 'text/javascript';
rScix.async = true;
rScix.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'd1stxfv94hrhia.cloudfront.net/waves/v3/w.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(rScix);
})();
</script>
<!-- RetentionScience end -->
Comments
0 comments
Please sign in to leave a comment.