Skip to content

A jquery wrapper for the javascript mixpanel integration lib

Notifications You must be signed in to change notification settings

lfborjas/jquery-mixpanel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Jquery mixpanel

A jquery plugin to wrap the default mixpanel javascript utilities

##Usage

 $('.misc-links').mixpanel({ 
     event: 'click',
     mixpanel_data: { 
            event: "my-event", 
            properties: { 
                "something":'about' 
                ,"something callable": function(e){$(e).text()} 
            } 
     } 
     ,token: "YOUR-TOKEN" 
     ,callback: function(element){ 
        window.location = $(element).attr("href"); 
     } 
 }); 
  • event: for which DOM event you which to bind the reporting to (defaults to 'click')
  • mixpanel_data: the data expected by mixpanel
  • token: your mixpanel token
  • callback: a function to execute after sending the asynchronous report; defaults to redirecting the href attribute of the element (as in a click in a hyperlink)

Note that the properties object in the mixpanel_data can contain functions; these functions will be passed the current DOM element as parameter when reporting, to let you extract things like text or surrounding information. This way you can bind this to multiple elements and still be able to access each one individually when reporting the event.

About

A jquery wrapper for the javascript mixpanel integration lib

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published