AmazingDreams / vue-matomo

Vue plugin for Matomo Analytics
MIT License
282 stars 61 forks source link

window._paq and this.$matomo #40

Closed yuritsuki closed 5 years ago

yuritsuki commented 5 years ago

this.$matomo works perfect. Tried to set UserID then get it. But I can't get UserId via _paq previously set in this.$matomo. Actually, I need this working for A/B tests. $matomo doesnt have functions for it. window._paq.push returns undefined in any get*** functions.

yuritsuki commented 5 years ago

console.log(this.$matomo.getPiwikUrl()) console.log(window._paq.push(['getPiwikUrl'])); image

AmazingDreams commented 5 years ago

As window._paq is a plain javascript array it would not be possible for matomo to return any values.

Are you able to use this.$matomo.getUserId()

yuritsuki commented 5 years ago

Yes, it works. I just checked if paq works. As I said I need to run ab tests which are able only via _paq.push(['AbTesting::create‘ ... (there are no api commands for ab testing) But I can’t get it working.

AmazingDreams commented 5 years ago

I think you can use this: https://developer.matomo.org/guides/ab-tests/browser#how-do-i-implement-an-experiment-without-using-_paqpush

Unfortunately I cannot do much about _paq.push returning undefined. It is simply the way javascript works.

yuritsuki commented 5 years ago

Thank you! I’ll try it tomorrow. If it works, I’ll close the issue.

yuritsuki commented 5 years ago

Seems like my _paq push works. But yesterday I couldn't get any result because it comes to matomo reports only after a few hours. So now I see my yesterday actions results.