GithubHelp home page GithubHelp logo

scott-coates / jquery-analyticseventtracking-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jorkas/jquery-analyticseventtracking-plugin

1.0 2.0 0.0 124 KB

jQuery plugin to handle google analytics event tracking.

JavaScript 100.00%

jquery-analyticseventtracking-plugin's Introduction

Google Analytics Event Tracking jQuery Plugin

A jQuery plugin that helps you set up easy Event Tracking With Google Analytics.

Features

  • Reading event tracking variables from HTML data attributes as default
  • Support delay for links to be sure that the logging to Google Analytics will be stored.
  • Ready for self defined functions to be able to handle the values that should be stored to Google Analytics by defining your own return values.

Dependencies

  • The plugin requires jQuery v1.4.3 (or higher). (HTML5 data attributes required)
  • The plugin requires Google Analytics script with `_gaq' variable set.

Usage

.analyticsEventTracking() to initialize event tracking at selected elements. You may pass an options object to customize the event values:

  • category Default is HTML data attribute at the element with data-jaet-report-category.

  • action Default is HTML data attribute at the element with data-jaet-report-action.

  • label Default is HTML data attribute at the element with data-jaet-report-label.

  • value Default is HTML data attribute at the element with data-jaet-report-value.

  • trackerName Default is _trackEvent.

  • delayed Default is true.

Examples

<a href="/signup" data-jaet-report-category="signup" data-jaet-report-action="signup-click">Sign up</a>
$("a").analyticsEventTracking();

Can also be coded like this:

<a href="/signup">Sign up</a>
$("a").analyticsEventTracking({
    category: "signup",
    action: "signup-click"
});

With external function to get the value for action

<a href="/signup">Sign up</a>
$("a").analyticsEventTracking({
    category: "signup",
    label: "signup-click",
    action: getEventAction
});

function getEventAction(){
    return $(this).attr("href");
}

Links

Please use the GitHub issue tracker for bug reports and feature requests.

jquery-analyticseventtracking-plugin's People

Contributors

jorkas avatar scott-coates avatar weltraumschaf avatar

Stargazers

 avatar

Watchers

 avatar  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.