Hi all
I've been looking around, but I can’t find a best practice or up to date descriptions for cookie warnings through the cookie manager (especially in Dynamicweb9).
First of what does the optinlevel (1-3?) cover? What’s the difference between them?
What the point of being able to choose the template and setting in the cookie manager if it’s always overruled (even when there’s no template selected) by the setting on website properties?
Is necessary to include JavaScript in the template to submit the cookie value (I thought you would inject the script)?
I’ve taken the JS from one of our Dynamicweb8 solutions, does it follow your best practice?
<script type="text/javascript">
function setOptInCookie(optInLevel) {
var xmlhttp;
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState === 4 && xmlhttp.status === 200) {
var div = document.getElementById(<id of cookie warning element>);
div.parentNode.removeChild(div);
return false;
}
return false;
}
xmlhttp.open("GET",
"/admin/public/CookieOptInLevelConfig.aspx?cmd=SetCookieOptInLevel&OptInLevel=" + optInLevel,
true);
xmlhttp.send();
return false;
}
</script>
Lastly we are trying to access item values on the area, but I can’t seem to get viewmodels to work in the Cookie template.
I’ve tried with both PageViewModel and ParagraphViewModel, but doing so trows an error saying the viewmodel has not been set.
Is it a bug or intended use?
Regards
Simon Nordahl