edx/edx-platform — pull request #3302 by rlucioni (2014-04-10 00:58:02+00:00)
Title: Add more granular pageview tracking, update Segment.io snippet

This PR addresses the majority of requests for analytics improvements proposed [here](https://edx-wiki.atlassian.net/wiki/display/PROD/Course+%28Discovery%29%5E2) (bottom of the page, Phase 1, part F).

More specifically, this adds support for using Segment.io to explicitly track views of the home, registration, login, dashboard, course listing, and course about pages; another pageview event serves as a catch-all, firing when any other page is viewed. This PR also adds two new user superproperties: one tracking whether a user is registered (always true for authenticated users - @marcotuts noted that this condition is appropriate for the analysis he wants to perform in Mixpanel), and the other tracking a user's current enrollment count. In order to achieve this, I had to update the Segment.io tracking snippet we've been using.

My approach here sends named "Page" events to Segment.io, which then routes these to Mixpanel as "Viewed [Name] Page" events. For example, if Segment.io receives a page event named "Registration," Mixpanel will be sent an event named "Viewed Registration Page." Once this is merged in, I'll turn off the auto-generated "Loaded a Page" events which are currently being sent to Mixpanel by Segment.io; the "Viewed Other Page" event, which contains the URL of the viewed page as a property, will take its place.

@sarina and @dianakhuang, could you please help me review this?

@shnayder, FYI.