Hi, I have difficulties to setup the first experim...
# ask-questions
b
Hi, I have difficulties to setup the first experiment with visual editor Background: I use Matomo Analytics as a Wordpress plugin, so the data source is MySQL. The Metrics has been set up already, it displays the results. I created an Experiment table with the suggested fields within the MySQL DB. But the Experiment script does not work. Should I write an extra module to put the data into this table?
Copy code
track: function (experimentId, variationId) {
      analytics.track("Experiment Viewed", {
        experimentId,
        variationId,
      });
    },
f
The default "analytics.track" code snippet is assuming you use segment.io. Matomo has its own way of tracking events so that code will need to change
Copy code
_paq.push(['trackEvent', 'Experiment', experimentId, variationId]);
Something like that should work (I don't have Matomo to test so this is just based on their documentation)
If you do that, you shouldn't need to create a new MySQL table at all for experiment impressions. You can use the existing Matomo events table instead.
b
Thanks, Matomo does not have a default experiment table, so I had to create one. I created a WP-Plugin, where I can put the script on the page. Still, I have the message "Missing Required Script". The save_experiment calls a PHP function via Jquery/Ajax. I tested it, the callback function "track" will never be called. When should it be called? Every time when the page is loaded, right?
Copy code
<script>
            window.GROWTHBOOK_CONFIG = {
                track: function (experimentId, variationId) {
                    save_experiment(experimentId, variationId);
                }
            }
        </script>
        <script async src="<https://growthbookapi.aitrainer.app/js/key_9a80cbad274f23d1.js>"></script>
I think I have the problem, I have the "Missing Required Script" when Growthbook tries to open the original page. Probably the jquery has been defined twice.
Copy code
Uncaught SyntaxError: Identifier '$' has already been declared
at ab-designer.cjs.production.min.js:1