angulartics-amplitude
v1.0.1
Published
Amplitude plugin for Angulartics
Downloads
8
Maintainers
Readme
angulartics-amplitude
Amplitude plugin for Angulartics.
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-amplitude
Then add angulartics.amplitude
as a dependency for your app:
require('angulartics')
angular.module('myApp', [
'angulartics',
require('angulartics-amplitude')
]);
bower
bower install angulartics-amplitude
Add the <script>
to your index.html
:
<script src="/bower_components/angulartics-amplitude/dist/angulartics-amplitude.min.js"></script>
Then add angulartics.amplitude
as a dependency for your app:
angular.module('myApp', ['angulartics','angulartics.amplitude']);
Documentation
- This plugin includes the snippet code provided by Amplitude.
myApp.config(['$analytics_amplitudeProvider', function($analytics_amplitudeProvider) { $analytics_amplitudeProvider.init("API_KEY"); // OR $analytics_amplitudeProvider.initWithProject("ProjectName", "API_KEY"); // OR $analytics_amplitudeProvider.initWithProjectAndFixedDeviceId("ProjectName", "API_KEY"); }]);
If needed, you can access the Amplitude object by injecting '$analytics_amplitude'. For instance:
```javascript
myApp.run(['$analytics_amplitude', function($analytics_amplitude) {
$analytics_amplitude.getInstance()...
}])
Check Amplitude documentation for more details.
- Tracking Event, Pages and setting user properties are done through '$analytics' service. This angulartics plugin supports the following analytics calls:
$analytics.pageTrack()
$analytics.eventTrack()
$analytics.setUsernames()
$analytics.setUserProperties()
$analytics.setUserPropertiesOnce()
$analytics.setSuperPropertiesOnce()
Check Angulartics documentation for more details.
Development
npm install
npm run build