alphagov/static — pull request #417 by GrouchPotato (2014-06-04 10:42:26+00:00)
Title: Add content seen tracking

Story: https://www.pivotaltracker.com/story/show/69606914

We've moved slightly away from the original story, due mostly to the limit on the amount of analytics events we're allowed to send. Having drilled into the actual requirements here it seems the main aim of scroll-tracking was to gain information on whether users are scrolling to see various bits of content.

This PR adds a script which looks for any elements with the class `track-seen` and reports to analytics with the element's id when that element has been seen.

```

Some below-the-fold content

```
Will make the event `Content, Seen, below_the_fold_content` when scrolled over.

Govspeak permits classes and ids on html elements, so tracking tags can be added to dynamic content without any changes to govspeak.