bower install git@github.com:rbsdev/google-analytics.git --savevargoogleAnalytics=newGoogleAnalytics({account: 'UA-XXXXX-X',category: 'project name'});googleAnalytics.trackEvent('button click','join');// _gaq.push(['_trackEvent', 'project name', 'button click', 'join']);googleAnalytics.push('_setCustomVar','custom key','custom value');// _gaq.push(['_setCustomVar', 'custom key', 'custom value']);Options
account
type: string
requiredallowLinker
type: boolean
default:trueautoInit
automatically set the basic configuration
type: boolean
default:trueautoLoad:
automatically inject the SDK
type: boolean
default:truebindData:
watch for data-ga attribute in clicked elements
type: boolean
default:truebindDataGlue:
the string used to separate arguments in data-ga attribute
type: RegExp
default:/\s*,\s*/gcategory
the category to use with further trackEvent calls
type: string
requireddomainName
type: string
default:clicrbs.com.brtrackPageview
type: boolean
default:truetrackUser
sets two custom vars with the user range and type
type: boolean
default:true
By default, any clicked element that has data-attribute on it will automatically fire an _trackEvent.
To disable this behavior, just set the bindData option to false.
<!-- by default, arguments are comma separeted --><!-- you can change that with the bindDataGlue option --><ahref="#top" data-ga="anchor click, back to top">Go back to the top</a><!-- _gaq.push(['_trackEvent', 'category', 'anchor click', 'back to top']); --><buttondata-ga="button click, join with us">Join with us</button><!-- _gaq.push(['_trackEvent', 'category', 'button click', 'join with us']); --># run tests
npm run test# make build
npm run build
# watch for changes
npm run watch
# bump version
bower version patch # major | minor | patch
git push --follow-tags