if statement crashes module...
September 25, 2015 12:00 AM
When adding an if statement in a header script which works fine so far, the module crashes and is published without layout and graphics. What might be wrong? I can not see an error in the JavaScript.
I would linkt to add an opt out function for (not) tracking user activities with piwik. The piwik code works fine. When sourrounding die piwik code with an if statement reacting on a userdefined variable (line 5 and 24), eyerything goes wrong.
undefined_paq.push(['setSiteId', 15]);
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setVisitorCookieTimeout', '604800']);
_paq.push(['setSessionCookieTimeout', '0']);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
var d=document,
g=d.createElement('script'),
s=d.getElementsByTagName('script')[0];
g.type='text/javascript';
g.defer=true;
g.async=true;
g.src=u+'piwik.js';
s.parentNode.insertBefore(g,s);
})();
}
undefined
Ofcourse there is an opt out code provided by piwik and it could be customized and inserted into an iframe. I will try this next, but an if statement should also work.
Discussion (2)
Solved!
Required variables must be defined...
Sorry for disturbing you.
Discussions have been disabled for this post