2017 © Pedro Peláez
 

silverstripe-module silverstripe-file-analytics

Fire google analytics events on direct file requests

image

clyons-eis/silverstripe-file-analytics

Fire google analytics events on direct file requests

  • Tuesday, April 7, 2015
  • by clyonsEIS
  • Repository
  • 1 Watchers
  • 0 Stars
  • 78 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 4 Open issues
  • 1 Versions
  • 16 % Grown

The README.md

Comments

Maintainers

  • Craig Lyons

Introduction

This module provides the ability to fire google analytics events when files are directly requested (i.e. PDFs) Client-side approach allows for simple install & negates the need for a separate analytics account (which is required for server-side solutions)., (*1)

Requirements

  • SilverStripe 3.1
  • Page must properly include jquery & google analytics (Classic, ga.js)

Installation

For apache, your .htaccess file will need to reroute requests to PDFs so they can hit a server-side FileAnalyticsController The RewriteRule is skipped query string for processed=1; this query string is provided by the JS redirect after tracking the event., (*2)

### PDF Tracking ###
RewriteCond %{QUERY_STRING} !processed=1
RewriteRule ^(.*\.pdf)$ file-analytics?seg=$1 [R=302,L,NC]
####################

Limitations

  • Because of the client-side redirect, a 301 status cannot be sent, so this will likely prevent PDFs from being indexed by search engines.
  • Only Classic Analytics is supported (ga.js). Look for Universal Analytics (analytics.js) in a future version.

The Versions

07/04 2015

dev-master

9999999-dev http://github.com/clyonsEIS/silverstripe-file-analytics

Fire google analytics events on direct file requests

  Sources   Download

BSD-3-Clause

The Requires

 

by Craig Lyons

silverstripe pdf track google-analytics file-analytics