Skip to content

Instantly share code, notes, and snippets.

@mediavrog
Last active August 26, 2016 03:33
Show Gist options
  • Save mediavrog/f53df7c6dd9737c89e13 to your computer and use it in GitHub Desktop.
Save mediavrog/f53df7c6dd9737c89e13 to your computer and use it in GitHub Desktop.

Revisions

  1. mediavrog revised this gist Oct 7, 2015. No changes.
  2. mediavrog created this gist Oct 7, 2015.
    8 changes: 8 additions & 0 deletions analytics.coffee
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    # add the tracking code normally to your layout; then include this in every page
    $(document).on 'page:change', ->
    if window.ga?
    ga('send', 'pageview');
    else if window._gaq?
    _gaq.push(['_trackPageview'])
    else if window.pageTracker?
    pageTracker._trackPageview()