angulartics-rails 0.15.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in angulartics-rails.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Ben Augarten
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # Angulartics::Rails
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'angulartics-rails'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install angulartics-rails
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'angulartics/rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "angulartics-rails"
8
+ spec.version = Angulartics::Rails::VERSION
9
+ spec.authors = ["Ben Augarten"]
10
+ spec.email = ["b.augarten@gmail.com"]
11
+ spec.description = %q{angulartics packaged in gem form}
12
+ spec.summary = %q{Add analytics to your angularjs application}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.require_paths = ["lib", "vendor"]
18
+
19
+ spec.add_development_dependency "bundler", "~> 1.3"
20
+ spec.add_development_dependency "rake"
21
+ spec.add_dependency "railties", "~> 4.1"
22
+ end
@@ -0,0 +1,8 @@
1
+ require "angulartics/rails/version"
2
+
3
+ module Angulartics
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ module Angulartics
2
+ module Rails
3
+ VERSION = "0.15.19"
4
+ end
5
+ end
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @license Angulartics v0.15.19
3
+ * (c) 2014 Luis Farzati http://luisfarzati.github.io/angulartics
4
+ * Adobe analytics(Omniture) update contributed by http://github.com/ajayk
5
+ * License: MIT
6
+ */
7
+ (function(angular) {
8
+ 'use strict';
9
+
10
+ /**
11
+ * @ngdoc overview
12
+ * @name angulartics.adobe.analytics
13
+ * Enables analytics support for Adobe Analytics (http://adobe.com/analytics)
14
+ */
15
+ angular.module('angulartics.adobe.analytics', ['angulartics'])
16
+ .config(['$analyticsProvider', function ($analyticsProvider) {
17
+
18
+ $analyticsProvider.settings.trackRelativePath = true;
19
+
20
+ $analyticsProvider.registerPageTrack(function (path) {
21
+ if (window.s) s.t([path]);
22
+ });
23
+
24
+ /**
25
+ * Track Event in Adobe Analytics
26
+ * @name eventTrack
27
+ *
28
+ * @param {string} action Required 'action' (string) associated with the event
29
+ *
30
+ *
31
+ */
32
+ $analyticsProvider.registerEventTrack(function (action) {
33
+ if (window.s) {
34
+ if(action) {
35
+ if(action.toUpperCase() === "DOWNLOAD")
36
+ s.tl(this,'d',action);
37
+ else if(action.toUpperCase() === "EXIT")
38
+ s.tl(this,'e',action);
39
+ }
40
+ else
41
+ s.tl(this,'o',action);
42
+ }
43
+ });
44
+
45
+ }]);
46
+ })(angular);
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license Angulartics v0.15.19
3
+ * (c) 2013 Luis Farzati http://luisfarzati.github.io/angulartics
4
+ * Contributed by http://github.com/chechoacosta
5
+ * License: MIT
6
+ */
7
+ (function(angular) {
8
+ 'use strict';
9
+
10
+ /**
11
+ * @ngdoc overview
12
+ * @name angulartics.chartbeat
13
+ * Enables analytics support for Chartbeat (http://chartbeat.com)
14
+ */
15
+ angular.module('angulartics.chartbeat', ['angulartics'])
16
+ .config(['$analyticsProvider', function ($analyticsProvider) {
17
+
18
+ angulartics.waitForVendorApi('pSUPERFLY', 500, function (pSUPERFLY) {
19
+ $analyticsProvider.registerPageTrack(function (path) {
20
+ pSUPERFLY.virtualPage(path);
21
+ });
22
+ });
23
+
24
+ $analyticsProvider.registerEventTrack(function () {
25
+ console.warn('Chartbeat doesn\'t support event tracking -- silently ignored.');
26
+ });
27
+
28
+ }]);
29
+ })(angular);
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license Angulartics v0.15.19
3
+ * (c) 2013 Luis Farzati http://luisfarzati.github.io/angulartics
4
+ * Contributed by http://github.com/samanbarghi
5
+ * License: MIT
6
+ */
7
+
8
+ (function(angular) {
9
+ 'use strict';
10
+
11
+ /**
12
+ * @ngdoc overview
13
+ * @name angulartics.flurry
14
+ * Enables analytics support for flurry (http://flurry.com)
15
+ */
16
+ angular.module('angulartics.flurry', ['angulartics'])
17
+ .config(['$analyticsProvider', function ($analyticsProvider) {
18
+
19
+
20
+ $analyticsProvider.registerPageTrack(function (path) {
21
+ //No separate track page functionality
22
+ });
23
+
24
+ $analyticsProvider.registerEventTrack(function (action, properties) {
25
+ FlurryAgent.logEvent(action, properties);
26
+ });
27
+
28
+ }]);
29
+ })(angular);
@@ -0,0 +1,91 @@
1
+ /**
2
+ * @license Angulartics v0.15.19
3
+ * (c) 2013 Luis Farzati http://luisfarzati.github.io/angulartics
4
+ * License: MIT
5
+ */
6
+ (function(angular) {
7
+ 'use strict';
8
+
9
+ /**
10
+ * @ngdoc overview
11
+ * @name angulartics.google.analytics
12
+ * Enables analytics support for Google Analytics (http://google.com/analytics)
13
+ */
14
+ angular.module('angulartics.google.analytics.cordova', ['angulartics'])
15
+
16
+ .provider('googleAnalyticsCordova', function () {
17
+ var GoogleAnalyticsCordova = [
18
+ '$q', '$log', 'ready', 'debug', 'trackingId', 'period',
19
+ function ($q, $log, ready, debug, trackingId, period) {
20
+ var deferred = $q.defer();
21
+ var deviceReady = false;
22
+
23
+ window.addEventListener('deviceReady', function () {
24
+ deviceReady = true;
25
+ deferred.resolve();
26
+ });
27
+
28
+ setTimeout(function () {
29
+ if (!deviceReady) {
30
+ deferred.resolve();
31
+ }
32
+ }, 3000);
33
+
34
+ function success() {
35
+ if (debug) {
36
+ $log.info(arguments);
37
+ }
38
+ }
39
+
40
+ function failure(err) {
41
+ if (debug) {
42
+ $log.error(err);
43
+ }
44
+ }
45
+
46
+ this.init = function () {
47
+ return deferred.promise.then(function () {
48
+ var analytics = window.plugins && window.plugins.gaPlugin;
49
+ if (analytics) {
50
+ analytics.init(function onInit() {
51
+ ready(analytics, success, failure);
52
+ }, failure, trackingId, period || 10);
53
+ } else if (debug) {
54
+ $log.error('Google Analytics for Cordova is not available');
55
+ }
56
+ });
57
+ };
58
+ }];
59
+
60
+ return {
61
+ $get: ['$injector', function ($injector) {
62
+ return $injector.instantiate(GoogleAnalyticsCordova, {
63
+ ready: this._ready || angular.noop,
64
+ debug: this.debug,
65
+ trackingId: this.trackingId,
66
+ period: this.period
67
+ });
68
+ }],
69
+ ready: function (fn) {
70
+ this._ready = fn;
71
+ }
72
+ };
73
+ })
74
+
75
+ .config(['$analyticsProvider', 'googleAnalyticsCordovaProvider', function ($analyticsProvider, googleAnalyticsCordovaProvider) {
76
+ googleAnalyticsCordovaProvider.ready(function (analytics, success, failure) {
77
+ $analyticsProvider.registerPageTrack(function (path) {
78
+ analytics.trackPage(success, failure, path);
79
+ });
80
+
81
+ $analyticsProvider.registerEventTrack(function (action, properties) {
82
+ analytics.trackEvent(success, failure, properties.category, action, properties.label, properties.value);
83
+ });
84
+ });
85
+ }])
86
+
87
+ .run(['googleAnalyticsCordova', function (googleAnalyticsCordova) {
88
+ googleAnalyticsCordova.init();
89
+ }]);
90
+
91
+ })(angular);
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @license Angulartics v0.15.19
3
+ * (c) 2013 Luis Farzati http://luisfarzati.github.io/angulartics
4
+ * Universal Analytics update contributed by http://github.com/willmcclellan
5
+ * License: MIT
6
+ */
7
+ (function(angular) {
8
+ 'use strict';
9
+
10
+ /**
11
+ * @ngdoc overview
12
+ * @name angulartics.google.analytics
13
+ * Enables analytics support for Google Analytics (http://google.com/analytics)
14
+ */
15
+ angular.module('angulartics.google.analytics', ['angulartics'])
16
+ .config(['$analyticsProvider', function ($analyticsProvider) {
17
+
18
+ // GA already supports buffered invocations so we don't need
19
+ // to wrap these inside angulartics.waitForVendorApi
20
+
21
+ $analyticsProvider.settings.trackRelativePath = true;
22
+
23
+ $analyticsProvider.registerPageTrack(function (path) {
24
+ if (window._gaq) _gaq.push(['_trackPageview', path]);
25
+ if (window.ga) ga('send', 'pageview', path);
26
+ });
27
+
28
+ /**
29
+ * Track Event in GA
30
+ * @name eventTrack
31
+ *
32
+ * @param {string} action Required 'action' (string) associated with the event
33
+ * @param {object} properties Comprised of the mandatory field 'category' (string) and optional fields 'label' (string), 'value' (integer) and 'noninteraction' (boolean)
34
+ *
35
+ * @link https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide#SettingUpEventTracking
36
+ *
37
+ * @link https://developers.google.com/analytics/devguides/collection/analyticsjs/events
38
+ */
39
+ $analyticsProvider.registerEventTrack(function (action, properties) {
40
+ // GA requires that eventValue be an integer, see:
41
+ // https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#eventValue
42
+ // https://github.com/luisfarzati/angulartics/issues/81
43
+ if(properties.value) {
44
+ var parsed = parseInt(properties.value, 10);
45
+ properties.value = isNaN(parsed) ? 0 : parsed;
46
+ }
47
+
48
+ if (window._gaq) {
49
+ _gaq.push(['_trackEvent', properties.category, action, properties.label, properties.value, properties.noninteraction]);
50
+ }
51
+ else if (window.ga) {
52
+ if (properties.noninteraction) {
53
+ ga('send', 'event', properties.category, action, properties.label, properties.value, {nonInteraction: 1});
54
+ } else {
55
+ ga('send', 'event', properties.category, action, properties.label, properties.value);
56
+ }
57
+ }
58
+ });
59
+
60
+ }]);
61
+ })(angular);
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @license Angulartics v0.15.19
3
+ * (c) 2013 Luis Farzati http://luisfarzati.github.io/angulartics
4
+ * Google Tag Manager Plugin Contributed by http://github.com/danrowe49
5
+ * License: MIT
6
+ */
7
+
8
+ (function(angular){
9
+ 'use strict';
10
+
11
+
12
+ /**
13
+ * @ngdoc overview
14
+ * @name angulartics.google.analytics
15
+ * Enables analytics support for Google Tag Manager (http://google.com/tagmanager)
16
+ */
17
+
18
+ angular.module('angulartics.google.tagmanager', ['angulartics'])
19
+ .config(['$analyticsProvider', function($analyticsProvider){
20
+
21
+ /**
22
+ * Send content views to the dataLayer
23
+ *
24
+ * @param {string} path Required 'content name' (string) describes the content loaded
25
+ */
26
+
27
+ $analyticsProvider.registerPageTrack(function(path){
28
+ var dataLayer = window.dataLayer = window.dataLayer || [];
29
+ dataLayer.push({
30
+ 'event': 'content-view',
31
+ 'content-name': path
32
+ });
33
+ });
34
+
35
+ /**
36
+ * Send interactions to the dataLayer, i.e. for event tracking in Google Analytics
37
+ * @name eventTrack
38
+ *
39
+ * @param {string} action Required 'action' (string) associated with the event
40
+ * @param {object} properties Comprised of the mandatory field 'category' (string) and optional fields 'label' (string), 'value' (integer) and 'noninteraction' (boolean)
41
+ */
42
+
43
+ $analyticsProvider.registerEventTrack(function(action, properties){
44
+ var dataLayer = window.dataLayer = window.dataLayer || [];
45
+ dataLayer.push({
46
+ 'event': 'interaction',
47
+ 'target': properties.category,
48
+ 'action': action,
49
+ 'target-properties': properties.label,
50
+ 'value': properties.value,
51
+ 'interaction-type': properties.noninteraction
52
+ });
53
+
54
+ });
55
+ }]);
56
+
57
+ })(angular);
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @license Angulartics v0.15.19
3
+ * (c) 2013 Luis Farzati http://luisfarzati.github.io/angulartics
4
+ * License: MIT
5
+ */
6
+ (function(angular) {
7
+ 'use strict';
8
+
9
+ /**
10
+ * @ngdoc overview
11
+ * @name angulartics.kissmetrics
12
+ * Enables analytics support for KISSmetrics (http://kissmetrics.com)
13
+ */
14
+ angular.module('angulartics.kissmetrics', ['angulartics'])
15
+ .config(['$analyticsProvider', '$window', function ($analyticsProvider, $window) {
16
+
17
+ // KM already supports buffered invocations so we don't need
18
+ // to wrap these inside angulartics.waitForVendorApi
19
+
20
+ // Creates the _kqm array if it doesn't exist already
21
+ // Useful if you want to load angulartics before kissmetrics
22
+ $window._kmq = _kmq || [];
23
+
24
+ $analyticsProvider.registerPageTrack(function (path) {
25
+ $window._kmq.push(['record', 'Pageview', { 'Page': path }]);
26
+ });
27
+
28
+ $analyticsProvider.registerEventTrack(function (action, properties) {
29
+ $window._kmq.push(['record', action, properties]);
30
+ });
31
+
32
+ }]);
33
+ })(angular);
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @license Angulartics v0.15.19
3
+ * (c) 2013 Luis Farzati http://luisfarzati.github.io/angulartics
4
+ * Contributed by http://github.com/L42y
5
+ * License: MIT
6
+ */
7
+ (function(angular) {
8
+ 'use strict';
9
+
10
+ /**
11
+ * @ngdoc overview
12
+ * @name angulartics.mixpanel
13
+ * Enables analytics support for Mixpanel (http://mixpanel.com)
14
+ */
15
+ angular.module('angulartics.mixpanel', ['angulartics'])
16
+ .config(['$analyticsProvider', function ($analyticsProvider) {
17
+ angulartics.waitForVendorApi('mixpanel', 500, '__loaded', function (mixpanel) {
18
+ $analyticsProvider.registerPageTrack(function (path) {
19
+ mixpanel.track( "Page Viewed", { "page": path } );
20
+ });
21
+ });
22
+
23
+ angulartics.waitForVendorApi('mixpanel', 500, '__loaded', function (mixpanel) {
24
+ $analyticsProvider.registerEventTrack(function (action, properties) {
25
+ mixpanel.track(action, properties);
26
+ });
27
+ });
28
+
29
+ angulartics.waitForVendorApi('mixpanel', 500, function (mixpanel) {
30
+ $analyticsProvider.registerSetUsername(function (userId) {
31
+ mixpanel.identify(userId);
32
+ });
33
+ });
34
+
35
+ angulartics.waitForVendorApi('mixpanel', 500, function (mixpanel) {
36
+ $analyticsProvider.registerSetUserProperties(function (properties) {
37
+ mixpanel.people.set(properties);
38
+ });
39
+ });
40
+
41
+ angulartics.waitForVendorApi('mixpanel', 500, function (mixpanel) {
42
+ $analyticsProvider.registerSetUserPropertiesOnce(function (properties) {
43
+ mixpanel.people.set_once(properties);
44
+ });
45
+ });
46
+ }]);
47
+ })(angular);
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @license Angulartics v0.15.19
3
+ * (c) 2013 Luis Farzati http://luisfarzati.github.io/angulartics
4
+ * Piwik 2.1.x update contributed by http://github.com/highskillz
5
+ * License: MIT
6
+ */
7
+ (function(angular) {
8
+ 'use strict';
9
+
10
+ /**
11
+ * @ngdoc overview
12
+ * @name angulartics.piwik
13
+ * Enables analytics support for Piwik (http://piwik.org/docs/tracking-api/)
14
+ */
15
+ angular.module('angulartics.piwik', ['angulartics'])
16
+ .config(['$analyticsProvider',
17
+ function($analyticsProvider) {
18
+
19
+ // Piwik seems to suppors buffered invocations so we don't need
20
+ // to wrap these inside angulartics.waitForVendorApi
21
+
22
+ $analyticsProvider.settings.trackRelativePath = true;
23
+
24
+ $analyticsProvider.registerPageTrack(function(path) {
25
+ if (window._paq) {
26
+ _paq.push(['setCustomUrl', path]);
27
+ _paq.push(['trackPageView']);
28
+ }
29
+ });
30
+
31
+ $analyticsProvider.registerEventTrack(function(action, properties) {
32
+ // GA requires that eventValue be an integer, see:
33
+ // https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#eventValue
34
+ // https://github.com/luisfarzati/angulartics/issues/81
35
+ if (properties.value) {
36
+ var parsed = parseInt(properties.value, 10);
37
+ properties.value = isNaN(parsed) ? 0 : parsed;
38
+ }
39
+ console.warn('Piwik doesn\'t support event tracking -- silently ignored.');
40
+ console.warn('\t action\t[%s]', action);
41
+ console.warn('\t category\t[%s]', properties.category);
42
+ console.warn('\t label\t[%s]', properties.label);
43
+ console.warn('\t value\t[%s]', properties.value);
44
+ console.warn('\t noninteraction\t[%s]', properties.noninteraction);
45
+ console.warn('');
46
+ });
47
+
48
+ }
49
+ ]);
50
+ })(angular);
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @license Angulartics v0.15.19
3
+ * (c) 2013 Luis Farzati http://luisfarzati.github.io/angulartics
4
+ * License: MIT
5
+ */
6
+ (function (angular) {
7
+ 'use strict';
8
+
9
+ /**
10
+ * @ngdoc overview
11
+ * @name angulartics.scroll
12
+ * Provides an implementation of jQuery Waypoints (http://imakewebthings.com/jquery-waypoints/)
13
+ * for use as a valid DOM event in analytics-on.
14
+ */
15
+ angular.module('angulartics.scroll', ['angulartics'])
16
+ .directive('analyticsOn', ['$analytics', function ($analytics) {
17
+ function isProperty(name) {
18
+ return name.substr(0, 8) === 'scrollby';
19
+ }
20
+ function cast(value) {
21
+ if (['', 'true', 'false'].indexOf(value) > -1) {
22
+ return value.replace('', 'true') === 'true';
23
+ }
24
+ return value;
25
+ }
26
+
27
+ return {
28
+ restrict: 'A',
29
+ priority: 5,
30
+ scope: false,
31
+ link: function ($scope, $element, $attrs) {
32
+ if ($attrs.analyticsOn !== 'scrollby') return;
33
+
34
+ var properties = { continuous: false, triggerOnce: true };
35
+ angular.forEach($attrs.$attr, function(attr, name) {
36
+ if (isProperty(attr)) {
37
+ properties[name.slice(8,9).toLowerCase()+name.slice(9)] = cast($attrs[name]);
38
+ }
39
+ });
40
+
41
+ $element.waypoint(function () {
42
+ $element.triggerHandler('scrollby');
43
+ }, properties);
44
+ }
45
+ };
46
+ }]);
47
+ })(angular);
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @license Angulartics v0.15.19
3
+ * (c) 2013 Luis Farzati http://luisfarzati.github.io/angulartics
4
+ * License: MIT
5
+ */
6
+ (function(angular) {
7
+ 'use strict';
8
+
9
+ /**
10
+ * @ngdoc overview
11
+ * @name angulartics.segment.io
12
+ * Enables analytics support for Segment.io (http://segment.io)
13
+ */
14
+ angular.module('angulartics.segment.io', ['angulartics'])
15
+ .config(['$analyticsProvider', function ($analyticsProvider) {
16
+ $analyticsProvider.registerPageTrack(function (path) {
17
+ try {
18
+ analytics.page(path);
19
+ } catch (e) {
20
+ if (!(e instanceof ReferenceError)) {
21
+ throw e;
22
+ }
23
+ }
24
+ });
25
+
26
+ $analyticsProvider.registerEventTrack(function (action, properties) {
27
+ try {
28
+ analytics.track(action, properties);
29
+ } catch (e) {
30
+ if (!(e instanceof ReferenceError)) {
31
+ throw e;
32
+ }
33
+ }
34
+ });
35
+ }]);
36
+ })(angular);
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @license Angulartics v0.15.19
3
+ * (c) 2013 Luis Farzati http://luisfarzati.github.io/angulartics
4
+ * License: MIT
5
+ */
6
+ (function (angular) {
7
+ 'use strict';
8
+
9
+ /**
10
+ * @ngdoc overview
11
+ * @name angulartics.splunk
12
+ * Enables analytics support for with custom collection backend API
13
+ * using (sp.js as described in http://blogs.splunk.com/2013/10/17/still-using-3rd-party-web-analytics-providers-build-your-own-using-splunk/)
14
+ */
15
+ angular.module('angulartics.splunk', ['angulartics'])
16
+ .config(['$analyticsProvider', function ($analyticsProvider) {
17
+
18
+ var errorFunction = function(){
19
+ throw "Define sp ";
20
+ };
21
+
22
+ var _sp = window.sp || { pageview: errorFunction, track :errorFunction};
23
+
24
+ $analyticsProvider.registerPageTrack(function (path) {
25
+ _sp.pageview(path);
26
+ });
27
+
28
+ $analyticsProvider.registerEventTrack(function (action, properties) {
29
+ _sp.track(action, properties);
30
+ });
31
+
32
+ }]);
33
+ })(angular);
34
+
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license Angulartics v0.15.19
3
+ * (c) 2013 Luis Farzati http://luisfarzati.github.io/angulartics
4
+ * License: MIT
5
+ */
6
+ (function(angular) {
7
+ 'use strict';
8
+
9
+ /**
10
+ * @ngdoc overview
11
+ * @name angulartics.woopra
12
+ * Enables analytics support for Woopra (http://www.woopra.com)
13
+ */
14
+ angular.module('angulartics.woopra', ['angulartics'])
15
+ .config(['$analyticsProvider', function ($analyticsProvider) {
16
+ $analyticsProvider.registerPageTrack(function (path) {
17
+ woopra.track('pv', {
18
+ url: path
19
+ });
20
+ });
21
+
22
+ $analyticsProvider.registerEventTrack(function (action, properties) {
23
+ woopra.track(action, properties);
24
+ });
25
+ }]);
26
+ })(angular);
@@ -0,0 +1,213 @@
1
+ /**
2
+ * @license Angulartics v0.15.19
3
+ * (c) 2013 Luis Farzati http://luisfarzati.github.io/angulartics
4
+ * License: MIT
5
+ */
6
+ (function(angular, analytics) {
7
+ 'use strict';
8
+
9
+ var angulartics = window.angulartics || (window.angulartics = {});
10
+ angulartics.waitForVendorApi = function (objectName, delay, containsField, registerFn) {
11
+ if (!registerFn) { registerFn = containsField; containsField = undefined; }
12
+ if (!Object.prototype.hasOwnProperty.call(window, objectName) || (containsField !== undefined && window[objectName][containsField] === undefined)) {
13
+ setTimeout(function () { angulartics.waitForVendorApi(objectName, delay, containsField, registerFn); }, delay);
14
+ }
15
+ else {
16
+ registerFn(window[objectName]);
17
+ }
18
+ };
19
+
20
+ /**
21
+ * @ngdoc overview
22
+ * @name angulartics
23
+ */
24
+ angular.module('angulartics', [])
25
+ .provider('$analytics', function () {
26
+ var settings = {
27
+ pageTracking: {
28
+ autoTrackFirstPage: true,
29
+ autoTrackVirtualPages: true,
30
+ trackRelativePath: false,
31
+ autoBasePath: false,
32
+ basePath: '',
33
+ bufferFlushDelay: 1000
34
+ },
35
+ eventTracking: {
36
+ bufferFlushDelay: 1000
37
+ }
38
+ };
39
+
40
+ var cache = {
41
+ pageviews: [],
42
+ events: [],
43
+ setUsername: [],
44
+ setUserProperties: [],
45
+ setUserPropertiesOnce: []
46
+ };
47
+
48
+ var bufferedPageTrack = function (path) {
49
+ cache.pageviews.push(path);
50
+ };
51
+ var bufferedEventTrack = function (event, properties) {
52
+ cache.events.push({name: event, properties: properties});
53
+ };
54
+ var bufferedSetUsername = function (name) {
55
+ cache.setUsername.push(name);
56
+ };
57
+ var bufferedSetUserProperties = function (properties) {
58
+ cache.setUserProperties.push(properties);
59
+ };
60
+ var bufferedSetUserPropertiesOnce = function (properties) {
61
+ cache.setUserPropertiesOnce.push(properties);
62
+ };
63
+
64
+ var api = {
65
+ settings: settings,
66
+ pageTrack: bufferedPageTrack,
67
+ eventTrack: bufferedEventTrack,
68
+ setUsername: bufferedSetUsername,
69
+ setUserProperties: bufferedSetUserProperties,
70
+ setUserPropertiesOnce: bufferedSetUserPropertiesOnce
71
+ };
72
+
73
+ var registerPageTrack = function (fn) {
74
+ api.pageTrack = fn;
75
+ angular.forEach(cache.pageviews, function (path, index) {
76
+ setTimeout(function () { api.pageTrack(path); }, index * settings.pageTracking.bufferFlushDelay);
77
+ });
78
+ };
79
+ var registerEventTrack = function (fn) {
80
+ api.eventTrack = fn;
81
+ angular.forEach(cache.events, function (event, index) {
82
+ setTimeout(function () { api.eventTrack(event.name, event.properties); }, index * settings.eventTracking.bufferFlushDelay);
83
+ });
84
+ };
85
+ var registerSetUsername = function (fn) {
86
+ api.setUsername = fn;
87
+ angular.forEach(cache.setUsername, function (name, index) {
88
+ setTimeout(function () { api.setUsername(name); }, index * settings.pageTracking.bufferFlushDelay);
89
+ });
90
+ };
91
+ var registerSetUserProperties = function (fn) {
92
+ api.setUserProperties = fn;
93
+ angular.forEach(cache.setUserProperties, function (properties, index) {
94
+ setTimeout(function () { api.setUserProperties(properties); }, index * settings.pageTracking.bufferFlushDelay);
95
+ });
96
+ };
97
+ var registerSetUserPropertiesOnce = function (fn) {
98
+ api.setUserPropertiesOnce = fn;
99
+ angular.forEach(cache.setUserPropertiesOnce, function (properties, index) {
100
+ setTimeout(function () { api.setUserPropertiesOnce(properties); }, index * settings.pageTracking.bufferFlushDelay);
101
+ });
102
+ };
103
+
104
+ return {
105
+ $get: function() { return api; },
106
+ settings: settings,
107
+ virtualPageviews: function (value) { this.settings.pageTracking.autoTrackVirtualPages = value; },
108
+ firstPageview: function (value) { this.settings.pageTracking.autoTrackFirstPage = value; },
109
+ withBase: function (value) { this.settings.pageTracking.basePath = (value) ? angular.element('base').attr('href').slice(0, -1) : ''; },
110
+ withAutoBase: function (value) { this.settings.pageTracking.autoBasePath = value; },
111
+ registerPageTrack: registerPageTrack,
112
+ registerEventTrack: registerEventTrack,
113
+ registerSetUsername: registerSetUsername,
114
+ registerSetUserProperties: registerSetUserProperties,
115
+ registerSetUserPropertiesOnce: registerSetUserPropertiesOnce
116
+ };
117
+ })
118
+
119
+ .run(['$rootScope', '$location', '$window', '$analytics', '$injector', function ($rootScope, $location, $window, $analytics, $injector) {
120
+
121
+
122
+ if ($analytics.settings.pageTracking.autoTrackFirstPage) {
123
+ /* Only track the 'first page' if there are no routes or states on the page */
124
+ var noRoutesOrStates = true;
125
+ if ($injector.has('$route')) {
126
+ var $route = $injector.get('$route');
127
+ for (var route in $route.routes) {
128
+ noRoutesOrStates = false;
129
+ break;
130
+ }
131
+ } else if ($injector.has('$state')) {
132
+ var $state = $injector.get('$state');
133
+ for (var state in $state.states) {
134
+ noRoutesOrStates = false;
135
+ break;
136
+ }
137
+ } else {
138
+ noRoutesOrStates = false;
139
+ }
140
+ if (noRoutesOrStates) {
141
+ if ($analytics.settings.pageTracking.autoBasePath) {
142
+ $analytics.settings.pageTracking.basePath = $window.location.pathname;
143
+ }
144
+ if ($analytics.settings.trackRelativePath) {
145
+ var url = $analytics.settings.pageTracking.basePath + $location.url();
146
+ $analytics.pageTrack(url);
147
+ } else {
148
+ $analytics.pageTrack($location.absUrl());
149
+ }
150
+ }
151
+ }
152
+ if ($analytics.settings.pageTracking.autoTrackVirtualPages) {
153
+ if ($analytics.settings.pageTracking.autoBasePath) {
154
+ /* Add the full route to the base. */
155
+ $analytics.settings.pageTracking.basePath = $window.location.pathname + "#";
156
+ }
157
+ if ($injector.has('$route')) {
158
+ $rootScope.$on('$routeChangeSuccess', function (event, current) {
159
+ if (current && (current.$$route||current).redirectTo) return;
160
+ var url = $analytics.settings.pageTracking.basePath + $location.url();
161
+ $analytics.pageTrack(url);
162
+ });
163
+ }
164
+ if ($injector.has('$state')) {
165
+ $rootScope.$on('$stateChangeSuccess', function (event, current) {
166
+ var url = $analytics.settings.pageTracking.basePath + $location.url();
167
+ $analytics.pageTrack(url);
168
+ });
169
+ }
170
+ }
171
+ }])
172
+
173
+ .directive('analyticsOn', ['$analytics', function ($analytics) {
174
+ function isCommand(element) {
175
+ return ['a:','button:','button:button','button:submit','input:button','input:submit'].indexOf(
176
+ element.tagName.toLowerCase()+':'+(element.type||'')) >= 0;
177
+ }
178
+
179
+ function inferEventType(element) {
180
+ if (isCommand(element)) return 'click';
181
+ return 'click';
182
+ }
183
+
184
+ function inferEventName(element) {
185
+ if (isCommand(element)) return element.innerText || element.value;
186
+ return element.id || element.name || element.tagName;
187
+ }
188
+
189
+ function isProperty(name) {
190
+ return name.substr(0, 9) === 'analytics' && ['On', 'Event'].indexOf(name.substr(9)) === -1;
191
+ }
192
+
193
+ return {
194
+ restrict: 'A',
195
+ scope: false,
196
+ link: function ($scope, $element, $attrs) {
197
+ var eventType = $attrs.analyticsOn || inferEventType($element[0]);
198
+
199
+ angular.element($element[0]).bind(eventType, function () {
200
+ var eventName = $attrs.analyticsEvent || inferEventName($element[0]);
201
+ var properties = {};
202
+ angular.forEach($attrs.$attr, function(attr, name) {
203
+ if (isProperty(name)) {
204
+ properties[name.slice(9).toLowerCase()] = $attrs[name];
205
+ }
206
+ });
207
+
208
+ $analytics.eventTrack(eventName, properties);
209
+ });
210
+ }
211
+ };
212
+ }]);
213
+ })(angular);
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: angulartics-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.15.19
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ben Augarten
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-06-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: railties
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '4.1'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '4.1'
62
+ description: angulartics packaged in gem form
63
+ email:
64
+ - b.augarten@gmail.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - .gitignore
70
+ - Gemfile
71
+ - LICENSE.txt
72
+ - README.md
73
+ - Rakefile
74
+ - angulartics-rails.gemspec
75
+ - lib/angulartics/rails.rb
76
+ - lib/angulartics/rails/version.rb
77
+ - vendor/assets/javascript/angulartics-adobe.js
78
+ - vendor/assets/javascript/angulartics-chartbeat.js
79
+ - vendor/assets/javascript/angulartics-flurry.js
80
+ - vendor/assets/javascript/angulartics-ga-cordova.js
81
+ - vendor/assets/javascript/angulartics-ga.js
82
+ - vendor/assets/javascript/angulartics-gtm.js
83
+ - vendor/assets/javascript/angulartics-kissmetrics.js
84
+ - vendor/assets/javascript/angulartics-mixpanel.js
85
+ - vendor/assets/javascript/angulartics-piwik.js
86
+ - vendor/assets/javascript/angulartics-scroll.js
87
+ - vendor/assets/javascript/angulartics-segmentio.js
88
+ - vendor/assets/javascript/angulartics-splunk.js
89
+ - vendor/assets/javascript/angulartics-woopra.js
90
+ - vendor/assets/javascript/angulartics.js
91
+ homepage: ''
92
+ licenses:
93
+ - MIT
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ - vendor
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ requirements: []
112
+ rubyforge_project:
113
+ rubygems_version: 1.8.24
114
+ signing_key:
115
+ specification_version: 3
116
+ summary: Add analytics to your angularjs application
117
+ test_files: []