A/B Testing - User ist not always shows the same variation

Hi everyone,

I have difficulties using the A/B-Testing-Tool. The variation, which was shown first, should be shown always to the same user. Though in my case the variation changes on the same page on reload. Furthermore if I open a different page, where the A/B-Test is active as well, the variations switch as well.

I tested this in chrome, within and without incognito mode. I made sure no Tracking/JS-blocker were active.

If someone had the same troubles Iā€™d be happy for help. Here is the A/B-Testing code, which is implemented via Matomo Tagmanager:

<!-- Matomo A/B Test -->
<script type="text/javascript">
    var _paq = _paq || [];
    _paq.push(['AbTesting::create', {
        name: 'V1_StickyOrtsuche-Desktop', // you can also use '6' (ID of the experiment) to hide the name
        percentage: 100,
        includedTargets: [{"attribute":"url","inverted":"0","type":"contains","value":"blog"}],
        excludedTargets: [],
        startDateTime: '2023/04/28 00:00:00 UTC',
        variations: [
            {
                name: 'original',
                activate: function (event) {
                    // usually nothing needs to be done here
                }
            },
            {
                name: 'Sticky_Variante1', // you can also use '6' (ID of the variation) to hide the name
                activate: function(event) {

jQuery("html body div#mm-0.mm-page.mm-slideout div.outsidewholewrap div#content.outerWrap.white div.innerWrap.clearfix div.sidebar div.search").hide();
                    


var txt1 =
'<div id="sticky_Ortsuche" style="background: #CC071F;background-image: url(\'https://deinetests.de/Fremd_Bilder/deutschland_karte.png\'); background-repeat: no-repeat; background-size: 45px; background-position-x: 32%; background-position-y: 3px;width:100%; text-align: center; height: 57px; padding: 6px 0 0 0; position: sticky; bottom: 0px;margin: 22px 0 0 0;"><div class="logo" style="width: 75px; height: 66px; background-image: url(\'https://www.hauslehrer.de/wp-content/themes/customtheme/images/smalllogo.png\'); float: right; background-size: 61px; background-repeat: no-repeat; margin: -24px 24%0px 0;"></div><div class="formab" style="width: 306px; padding: 4px; margin: auto; background: #ecf0f1;"><form style=";" method="post" action=""><input type="text" name="plzort" placeholder="PLZ / Ort eingeben" style="border: 1px solid #ccc;height: 37px;padding: 8px 8px;"><input type="submit" name="submit" value="Finden" style="color: #fff;background-color: #444;padding: 5px 10px 5px 10px;font-size: 18px;margin: 2px auto auto 12px;"></form></div></div>';

jQuery("html body div#mm-0.mm-page.mm-slideout div.outsidewholewrap div#content.outerWrap.white").append(txt1);






                }
            }            
        ],
        trigger: function () {
            return true; // here you can further customize which of your visitors will participate in this experiment
        }
    }]);
</script>
<!-- Matomo A/B Test -->

Thanks a lot

David

Hi @Klicklaut
As this concerns premium plugin, I let @innocraft answer your question (or you can reach the dedicated support team (please select ā€œMatomo Premium Featureā€):

Hello, I opened a new thread just some moments ago asking where I can find good documentation to implement the A/B testing Matomo plugin using Node.JS. Can anyone provide some guidance? Thank you!

@innocraft, any news about this?

Hi @GabrielLeni , @Klicklaut ,

There is no specific documentation for AB test in NodeJS, you just need to add the AB test tracking code before the trackpageview method using the NodeJS SDK, please review https://developer.matomo.org/guides/spa-tracking.

1 Like