Skip to content

Instantly share code, notes, and snippets.

@alexanderdean
Forked from yalisassoon/itemViewTrack.md
Created December 18, 2012 13:17
Show Gist options
  • Save alexanderdean/4327909 to your computer and use it in GitHub Desktop.
Save alexanderdean/4327909 to your computer and use it in GitHub Desktop.

trackItemView and trackPageView improvements

Details

Reference: snowplow/snowplow#113

Idea from: https://github.com/kingo55

See also:

Summary

There are two parts to this spec:

  1. Add a new trackItemView() method to the JavaScript tracker
  2. Extend the existing trackPageView() functionality so it works better with trackItemView

trackItemView

Overview

This is a new feature to track views of products on ecommerce sites, or suggested articles on a media site, similar to how Google AdWords tracks ad views in different positions on a page.

Tracker specification

Add a new method trackItemView() like so:

Parameter Required? Example value
item ID / sku Yes 'pbz0001234'
item name No, but advisable (to make interpreting SKU easier) 'Black Tarot', 'Pippa in royal romp shocker'
display format / area No 'summary listing', 'lightbox', 'related articles'
item ranking No 4
item location No 'div-cat-4'

Item views are a new event type:

  • Added to the tracker protocol as &e=iv
  • Fields in tracker protocol prepended with iv_
  • page_url is obviously set for all item views

Example:

  _snaq.push(['trackItemView',
    'business-20752215',    // SKU/item code - required
    'Japan elections: Shares rise and yen weakens on Abe win', // item name
    'recommended articles', // display format / area
    3,                      // item ranking
                            // item location (not set)
  ]);

ETL, Storage specification

  • Each item view becomes a single event in SnowPlow
  • All fields are extracted into new fields in Hive/Infobright. No enrichment is required - all fields are just passed through
  • The event field will be set to item_view

trackPageView

Overview

Currently, trackPageView() only supports one (optional) argument, a custom title for the page. We propose adding three additional optional arguments to support a wider set of analyses, including across item views.

Tracker specification

Add three additional arguments, making a total of four arguments, all optional:

Parameter Required? Example value
page title No (defaults to page's TITLE) 'SnowPlow > About > Contact'
page type No 'category-page', 'checkout'
item ID / sku No 'pbz0001234'
item name No, but advisable (to make interpreting SKU easier) 'Black Tarot', 'Pippa in royal romp shocker'

Example:

_snaq.push(['trackPageView',
 'Shop > Tarot > Black Tarot',  // page title
 'product-detail',              // page type
 'pbz0001234'                   // item ID / sku
 'Black Tarot'                  // item name
]);

These additional fields will be passed in on the querystring with a pv_ prefix.

These fields should also be passed through for page-pings.

ETL, Storage specification

  • The fields will be extracted by the ETL as-is - no enrichment required
  • The fields will be stored in Hive/Infobright with a page_ prefix

Roadmap

  • Extend trackItemView so it can use the 10 custom var slots for events, and the cv_json custom var slot for a JSON (waiting on SnowPlow custom vars implementation)
  • Enable support for storing tags associated with an item
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment