Angulartics 2
Angulartics 2 integration
Before starting your application instrumentation, ensure that you have created an app and have an appKey
Install & Setup
Paste the following JavaScript code in the main html file of your app
// Start Pyze Script
<script type="text/javascript">
var pyzeAppKey="YOUR_PYZE_APP_KEY";
!function(e,t){var s=e.Pyze||{_q:[]},i=e.PyzeEvents||{_q:[]},n=e.PyzeCuratedEvents||{_q:[]},r=e.PyzeIdentity||{_q:[]};function p(t,e){function s(e){t[e]=function(){t._q.push([e].concat(Array.prototype.slice.call(arguments,0)))}}for(var i=0;i<e.length;i++)s(e[i])}p(s,["initialize","getTimerReference","getAppInstanceId","postWebAppVersion","postPageView","setUserOptOut","deleteUser"]),p(i,["postCustomEvent","startTimerForEvent","postCustomEventWithAttributes","postTimedEvent","postTimedEventWithAttributes","postExplicitActivation"]),p(n,["post"]),p(r,["setUserProfile","resetUserProfile","updateUserProfile"]);var o=t.createElement("script"),a=t.getElementsByTagName("script")[0];o.type="text/javascript",o.async=!0,o.src="https://cdn.pyze.com/pyze.js",a.parentNode.insertBefore(o,a),e.Pyze=s,e.PyzeEvents=i,e.PyzeCuratedEvents=n,e.PyzeIdentity=r}(window,document),Pyze.initialize(pyzeAppKey);
</script>
// End Pyze Script
Warning
Make sure you replacedYOUR_PYZE_APP_KEY
with your own appKey
Import Pyze provider in the root component.
import { Angulartics2Module } from 'angulartics2';
import { Angulartics2Pyze } from 'angulartics2/pyze';
Call startTracking() to start the tracking of route changes.
@Component({ ... })
export class AppComponent {
constructor(angulartics2Pyze: Angulartics2Pyze) {
angulartics2Pyze.startTracking();
}
}
Check Setup Angulartics using Angulartics2Pyze
for more details
API Reference
Full API reference available here
Last modified 2020-12-03