GithubHelp home page GithubHelp logo

agiza / ga_cdm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joshwilsonnc/ga_cdm

0.0 2.0 0.0 304 KB

Custom implementation of Google Analytics for CONTENTdm 6 that enables tracking metadata fields as GA events

JavaScript 100.00%

ga_cdm's Introduction

A custom implementation of Google Analytics for CONTENTdm 6 users that enables recording metadata field values as GA events

Updated September 2014: set Version to 2.0 - improved jQuery integration for better cross-browser compatibility. It is very important to upgrade to this version to ensure events are tracked across all browsers. Previous code versions have been discovered to miss data in some browsers for recent versions of CONTENTdm.

About

This code evolved from our interest in tracking pageviews of specific items in our digital collections. We wanted a useful way to record metadata field values as part of the data. For example, in our state publications collections, we utilize an "Agency-Current" field which contains the name of the state agency that published the item. This code enables us to specify which fields we wanted to track, and they are recorded as events.

Metadata in CONTENTdm

In this example, if I was tracking the "Agency-Current" field, when an item with that field was viewed, an event would be recorded:

How metadata is recorded in Google Analytics

By default, the event category will be "Pageview by metadata field". The field name will be recorded as the event action, and the field value as the event label.

analytics.js (universal analytics)

To configure, edit the analyticsjs_cdm.js file

  • Ensure that analytics is enabled in CONTENTdm's Website Configuration Tool
  • Add the metadata field names you want to record usage of in the trackTheseFields array
ga.js (classic analytics)

To configure, edit the ga_cdm.js file

  • Add the metadata field names you want to record usage of in the trackTheseFields array
  • Edit gaAccount so that it contains your GA account number
  • Edit digitalCollectionsDomain so that it contains your site's domain
  • Optionally edit hostedAliasDomain if you have a hosted instance URL

ga_cdm's People

Contributors

joshwilsonnc avatar

Watchers

James Cloos avatar Anthony Giza avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.