/angulartics-localytics

Localytics plugin for Angulartics

Primary LanguageHTMLMIT LicenseMIT

angulartics-localytics

NPM version NPM downloads Bower version Dependencies status MIT license Join the Slack chat

Localytics plugin for Angulartics.

Important Note

This plugin has no maintainers at the moment. If you use Localytics and want to contribute with code/documentation/examples and become an active maintainer of this project, please let us know.

Install

First make sure you've read installation and setup instructions for Angulartics.

Then you can install this package either with npm or with bower.

npm

npm install angulartics-localytics

Then add angulartics.localytics as a dependency for your app:

require('angulartics')

angular.module('myApp', [
  'angulartics',
  require('angulartics-localytics')
]);

Please note that core Angulartics doesn't export the name yet, but it will once we move it into the new organization.

bower

bower install gemr/angulartics-localytics

Add this <script> to your index.html:

<script>
    +function(l,y,t,i,c,s) {
        l['LocalyticsGlobal'] = i;
        l[i] = function() { (l[i].q = l[i].q || []).push(arguments) };
        l[i].t = +new Date;
        (s = y.createElement(t)).type = 'text/javascript';
        s.src = '//web.localytics.com/v3/localytics.min.js';
        (c = y.getElementsByTagName(t)[0]).parentNode.insertBefore(s, c);
        ll('init', 'YOUR-LOCALYTICS-APP-KEY', {} /* Options */);
    }(window, document, 'script', 'll');
</script>

Then add angulartics.localytics as a dependency for your app:

angular.module('myApp', [
  'angulartics',
  'angulartics.localytics'
]);

Documentation

User tracking

For user tracking, the angulartics setUsername field must be a user id for localytics. For user properties, localytics accepts an email address and an username only.

$analytics.setUsername(userId)
$analytics.setUserProperties({ email: EMAILADDRESS, userName: USERNAME});

Addtional documentation is available on the Angulartics site.

Development

npm run build

License

MIT