Skip to content

Commit

Permalink
bump version to 0.0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
revolunet committed Feb 26, 2015
1 parent 96cce7a commit d028eac
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 23 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "revolunet",
"name": "angular-google-analytics",
"description": "Easy Analytics for your AngularJS application",
"version": "0.0.10",
"version": "0.0.11",
"homepage": "https://github.com/revolunet/angular-google-analytics",
"repository": {
"type": "git",
Expand Down
54 changes: 35 additions & 19 deletions dist/angular-google-analytics.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Angular Google Analytics - Easy tracking for your AngularJS application
* @version v0.0.10 - 2015-01-22
* @version v0.0.11 - 2015-02-26
* @link http://github.com/revolunet/angular-google-analytics
* @author Julien Bouquillon <[email protected]>
* @license MIT License, http://www.opensource.org/licenses/MIT
Expand All @@ -26,7 +26,8 @@ angular.module('angular-google-analytics', [])
ignoreFirstPageLoad = false,
crossDomainLinker = false,
crossLinkDomains,
linkerConfig = {'allowLinker': true};
linkerConfig = {'allowLinker': true},
trackUrlParams = false;

this._logs = [];

Expand Down Expand Up @@ -110,14 +111,19 @@ angular.module('angular-google-analytics', [])
return true;
};

this.trackUrlParams = function (val) {
trackUrlParams = !!val;
return true;
};

/**
* Public Service
*/
this.$get = ['$document', '$location', '$log', '$rootScope', '$window', function ($document, $location, $log, $rootScope, $window) {
var me = this;

var getUrl = function () {
var url = $location.path();
var url = trackUrlParams ? $location.url() : $location.path();
return removeRegExp ? url.replace(removeRegExp, '') : url;
};

Expand Down Expand Up @@ -301,9 +307,10 @@ angular.module('angular-google-analytics', [])
https://developers.google.com/analytics/devguides/collection/analyticsjs/pages
* @param url
* @param title
* @param custom
* @private
*/
this._trackPage = function (url, title) {
this._trackPage = function (url, title, custom) {
var that = this, args = arguments;
url = url ? url : getUrl();
title = title ? title : $document[0].title;
Expand All @@ -314,18 +321,19 @@ angular.module('angular-google-analytics', [])
that._log('_trackPageview', url, title, args);
});
_analyticsJs(function () {
var opt_fieldObject = {
'page': trackPrefix + url,
'title': title
};
if (angular.isObject(custom)) {
angular.extend(opt_fieldObject, custom);
}
if (angular.isArray(accountId)) {
accountId.forEach(function (trackerObj) {
$window.ga(_generateCommandName('send', trackerObj), 'pageview', {
'page': trackPrefix + url,
'title': title
});
$window.ga(_generateCommandName('send', trackerObj), 'pageview', opt_fieldObject);
});
} else {
$window.ga('send', 'pageview', {
'page': trackPrefix + url,
'title': title
});
$window.ga('send', 'pageview', opt_fieldObject);
}
that._log('pageview', url, title, args);
});
Expand All @@ -340,23 +348,31 @@ angular.module('angular-google-analytics', [])
* @param label
* @param value
* @param noninteraction
* @param custom
* @private
*/
this._trackEvent = function (category, action, label, value, noninteraction) {
this._trackEvent = function (category, action, label, value, noninteraction, custom) {
var that = this, args = arguments;
_gaJs(function () {
$window._gaq.push(['_trackEvent', category, action, label, value, !!noninteraction]);
that._log('trackEvent', args);
});
_analyticsJs(function () {
var opt_fieldObject = {};
if (angular.isDefined(noninteraction)) {
opt_fieldObject['nonInteraction'] = !!noninteraction;
}
if (angular.isObject(custom)) {
angular.extend(opt_fieldObject, custom);
}
if (angular.isArray(accountId)) {
accountId.forEach(function (trackerObj) {
if (_checkOption('trackEvent', trackerObj)) {
$window.ga(_generateCommandName('send', trackerObj), 'event', category, action, label, value);
$window.ga(_generateCommandName('send', trackerObj), 'event', category, action, label, value, opt_fieldObject);
}
});
} else {
$window.ga('send', 'event', category, action, label, value);
$window.ga('send', 'event', category, action, label, value, opt_fieldObject);
}
that._log('event', args);
});
Expand Down Expand Up @@ -759,11 +775,11 @@ angular.module('angular-google-analytics', [])
enhancedEcommerceEnabled: function () {
return me._enhancedEcommerceEnabled();
},
trackPage: function (url, title) {
me._trackPage(url, title);
trackPage: function (url, title, custom) {
me._trackPage(url, title, custom);
},
trackEvent: function (category, action, label, value, noninteraction) {
me._trackEvent(category, action, label, value, noninteraction);
trackEvent: function (category, action, label, value, noninteraction, custom) {
me._trackEvent(category, action, label, value, noninteraction, custom);
},
addTrans: function (transactionId, affiliation, total, tax, shipping, city, state, country, currency) {
me._addTrans(transactionId, affiliation, total, tax, shipping, city, state, country, currency);
Expand Down
Loading

0 comments on commit d028eac

Please sign in to comment.