Hello,
I want to use the a/b-testing feature inside a vuejs/nuxt-application. I use https://github.com/pimlie/nuxt-matomo/issues/30 to integrate matomo into nuxt.
In a vue-component I tried something like this to push the experiment:
const _paq = (window._paq = window._paq || []);
_paq.push([
'AbTesting::create',
{
But I get an error like this:
_paq.push() was used but Matomo tracker was not initialized before the matomo.js file was loaded. Make sure to configure the tracker via _paq.push before loading matomo.js. Alternatively, you can create a tracker via Matomo.addTracker() manually and then use _paq.push but it may not fully work as tracker methods may not be executed in the correct order.
Can you help me with this? I can access the functions from the JS-Tracking-Client (https://developer.matomo.org/api-reference/tracking-javascript) but don’t know how to use it with an a/b-test. And also I don’t know how to solve the push-error.
I just found some info at https://developer.matomo.org/guides/ab-tests/browser#can-i-integrate-the-ab-tests-when-i-use-a-framework-like-angular-ember-reactjs but I don’t understand where the Matomo.AbTesting.Experiment comes from.
Thanks for some help!
Best regards,
Timo