angulartics2 icon indicating copy to clipboard operation
angulartics2 copied to clipboard

Events tracked in HTML sent as undefined to Google Analytics

Open KholofeloMoyaba opened this issue 6 years ago • 1 comments

For support questions, please consider using Gitter - Chat

I'm submitting a ...

  • [x] bug report

  • [ ] feature request

  • [ ] question about the decisions made in the repository

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem Use version 6.1.0 or 6.0.0 of angulartics Use HTML event tracking as below

<a target="_blank" href="https://www.linkedin.com" title="LinkedIn" angulartics2On="click" angularticsAction="LinkClick" angularticsLabel="social" angularticsValue="linkedin" angularticsCategory="contact">

The event gets sent to Google Analytics as expected but all the properties (label, category etc.) are undefined. Upon further investigation I tracked the actual HTTP call to ga and it indeed had undefined.

These are the query parameters sent:

v: 1
_v: j67
a: 338651396
t: event
ni: 0
_s: 1
dl: http://localhost/
ul: en-us
de: UTF-8
dt: palota
sd: 24-bit
sr: 1440x900
vp: 861x918
je: 0
ec: undefined
ea: undefined
_u: SACAAUAB~
jid: 
gjid: 
cid: ---
tid: ---
_gid: ---
gtm: ---
z: 883354700
  • What is the expected behavior? The event properties should be sent as defined in the directives.

  • What is the motivation / use case for changing the behavior?

  • Environment:

please run the following and copy the output

./node_modules/.bin/ng --version

Angular CLI: 1.7.4 Node: 8.9.4 OS: darwin x64 Angular: 6.0.2 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router

@angular/cli: 1.7.4 @angular-devkit/build-optimizer: 0.3.2 @angular-devkit/core: 0.3.2 @angular-devkit/schematics: 0.3.2 @ngtools/json-schema: 1.2.0 @ngtools/webpack: 1.10.2 @schematics/angular: 0.3.2 @schematics/package-update: 0.3.2 typescript: 2.7.2 webpack: 3.11.0

KholofeloMoyaba avatar May 18 '18 07:05 KholofeloMoyaba

I am running into this same problem where in the HTML I put directives necessary etc to send to google analytics but it does not work.

If I do it within the typescript though and utilize angularitics2.eventTrack.next({}) it works as expected.

Is there any plans to fix this?

@scttcper

alexw10 avatar Jul 17 '19 18:07 alexw10