Tracking events in Angulartics2

571 views Asked by At

I'm trying to add some tracking to my project and the page tracking seem to be working fine but not the event trackning. I've tried with event trackning as following:

<button angulartics2On="click" angularticsAction="Make Offer Click" angularticsLabel="Make Offer Click" angularticsValue="123" [angularticsProperties]="{'productID': 123, 'productTitle': 'A title to die for', 'productCountry': 'EN'}" type="button">Track this</button>

I've also tried to fire the event trackning from the component like this:

import { Angulartics2LaunchByAdobe } from 'angulartics2/launch';
import {Angulartics2} from "angulartics2";

constructor(angulartics2LaunchByAdobe: Angulartics2LaunchByAdobe,
    private angulartics2: Angulartics2) {
    angulartics2LaunchByAdobe.startTracking();
  }

...

this.angulartics2.eventTrack.next({
      action: 'Make offer clicked',
      properties: {'productID': 123, 'productTitle': 'Product 123', 'productCountry': 'EN'}
  });

My app.module looks like this:

import { Angulartics2Module } from 'angulartics2';
import { Angulartics2LaunchByAdobe } from 'angulartics2/launch';
...
imports: [
  Angulartics2Module.forRoot()
  ]

None of the above are showing anything being fired in the Network tab. But I can see that the page tracking event is fired on page load.

1

There are 1 answers

0
Pierre Messo On BEST ANSWER

So I found the issue. It was due to wrongly named event in the Adobe Launch tracking(which is done by some one else). The documentation says:

Once set up, Angulartics usage is the same regardless of provider. Route changes will be tracked using a "Direct call" Event named "pageTrack", and events or activities can be tracked using a "Direct call" Event named "eventTrack".

So the Adobe Launch department had it named "appEventData" and when changing it to "eventTrack" it all worked immediately.