JavaScript code does not work in Storyline
Hi there,
we want to track a slide of an e-learning ba using Matomo Pixeltracking and JavaScript. The JavaScript works perfectly, when integrated in a HTML file. But when I integrate the same code in a Storyline 360 file in a trigger, the tracking does not work. Does anyone have an idea, where the problem is?
I use the following code. The alert at the end always works fine but not the tracking:
var _paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://mytrackingsite.de/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '4']);
_paq.push(['trackGoal', 1]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
alert("tracking sent");