Search code examples
angularjsgoogle-analyticsmeasurement-protocol

Where is my event tracking in Google Analytic?


I code my click event in my Angular like below:

onProductClicked() {
   (<any>window).ga('send', 'event', {
      eventCategory: 'Click',
      eventLabel: this.item.provider,
      eventAction: 'click-on-product',
      eventValue: this.item.price + "~" + this.item.name
   });
}

And the above event triggers below request on my Chrome console:

https://www.google-analytics.com/r/collect?v=1&_v=j70&a=2055787371&t=event&_s=2&dl=http%3A%2F%2Flocalhost%2Fsearch%3Fq%3Diphone%2520x&dp=%2Fsearch%3Fq%3Diphone%2520x&ul=en-us&de=UTF-8&dt=mydomain.com&sd=24-bit&sr=1366x768&vp=817x657&je=0&ec=Click&ea=click-on-product&el=Domain&ev=Rp%204.423.395%2C-~IPhone%206%20&_u=SACAAEAB~&jid=XXXXXXXXX&gjid=XXXXXXXXX&cid=XXXXXXX.XXXXXXXXXX&tid=UA-XXXXXXXXX-X&_gid=XXXXXXXXX.XXXXXXXXX&_r=1&z=XXXXXXXXX

My question is, why the above event didn't captured in my Event dashboard in Google analytic dashboard?

enter image description here

Is there anything that I missed?


Solution

  • It's not showing because the hit being sent is not valid, since the expected value type for Event Value (ev) is integer, not string.

    Taken from Measurement Protocol's Parameter Reference for ev:

    +-----------+------------+---------------+------------+---------------------+
    | Parameter | Value Type | Default Value | Max Length | Supported Hit Types |
    +-----------+------------+---------------+------------+---------------------+
    | ev        | integer    | None          | None       | event               |
    +-----------+------------+---------------+------------+---------------------+
    

    I would suggest to make the necessary modification, and try to send a hit via Hit Builder to make sure everything works.