if statement crashes module...

rfuest6134 Community Member Posts: 43
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.
<!-- Seitentitel anpassen -->
document.title = VarCurrentTitleName.getValue() + ": " + VarCurrentPageName.getValue();
<!-- Piwik -->
<!-- wenn kein opt-out -->
if (VarPiwikStatus.getValue() == "on") {
var _paq = _paq || [];
var u=(("https:" == document.location.protocol) ? "https://piwik.URL/" : "http://piwik.URL/");
_paq.push(['setSiteId', 15]);
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setVisitorCookieTimeout', '604800']);
_paq.push(['setSessionCookieTimeout', '0']);
var d=document,
<!-- End Piwik Code -->
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.


Sign In or Register to comment.

So You Wanna Be An eLearning ROCKSTAR?

We're all fans of eLearning here! Want to become an eLearning ROCKSTAR? Just click on one of the buttons below to start your rocking journey!