Difference between revisions of "Implementing EUGDPR in ConversionRuler"
(Created page with "ConversionRuler can adhere to all aspects of GDPR as instituted and enforced in EU Countries starting May 2018. To do so requires some modifications to the standa...") |
|||
Line 55: | Line 55: | ||
Using your server-side language, the code would appear as follows: | Using your server-side language, the code would appear as follows: | ||
− | <?php | + | <nowiki><?php |
if (isset($_COOKIE['consent']) && $_COOKIE['consent'] === '1') { | if (isset($_COOKIE['consent']) && $_COOKIE['consent'] === '1') { | ||
$siteid = 'SITEID'; | $siteid = 'SITEID'; | ||
echo '<noscript><div style="position: fixed; left: 0; top: 0"><img src="https://www.conversionruler.com/bin/tracker.php?siteid=${siteid}&nojs=1" alt="" width="1" height="1" /></div></noscript>'; | echo '<noscript><div style="position: fixed; left: 0; top: 0"><img src="https://www.conversionruler.com/bin/tracker.php?siteid=${siteid}&nojs=1" alt="" width="1" height="1" /></div></noscript>'; | ||
} | } | ||
− | + | </nowiki> | |
The quick explanation is that the server-side code checks to see if the <code>consent</code> cookie is set, and if it is, then it outputs the <code><noscript></code> to enable tracking. | The quick explanation is that the server-side code checks to see if the <code>consent</code> cookie is set, and if it is, then it outputs the <code><noscript></code> to enable tracking. | ||
Revision as of 23:04, 8 May 2018
ConversionRuler can adhere to all aspects of GDPR as instituted and enforced in EU Countries starting May 2018.
To do so requires some modifications to the standard ConversionRuler Tracking Snippets and the following requirements:
- Web site visitors should support JavaScript
- The
<noscript>
tags associated with ConversionRuler must only be presented via a server-side include code once consent is given.
Contents
Conditional inclusion of ConversionRuler tracking: JavaScript Version
Requirements
- A custom version of the ConversionRuler tracking snippet
Implementation
To include ConversionRuler conditionally based on consent, a cookie must be set to a specific value. For these examples, we'll use the cookie named consent
and set it to a value of 1
when the visitor consents to be tracked.
Our ConversionRuler snippet code is then:
(function (w, cc, id, q) { var f="; ",s='script',d=w.document,p=d.getElementsByTagName(s)[0]; w.cr_load = function () { var n=d.createElement(s); w._crq=w._crq?w._crq:[]; w._crq.push(q); w._crq.push(function (cr) { cr.cookie(cc,1); }); n.src='//www.conversionruler.com/bin/js.php?siteid='+id; p.parentNode.insertBefore(n, p); }; if ((d.cookie+f).indexOf(cc+"=1"+f) >= 0) { w.cr_load(); } }(window,'consent','SITEID',0));
The above code is different in two significant ways from the standard ConversionRuler code:
- By default, ConversionRuler tracking is not loaded
- A new global function called
cr_load
is created which can be invoked immediately when consent is given.
The global function will:
- Load ConversionRuler and tracking code and record a landing for the page
- Set the
consent
cookie to the value1
Conditional inclusion of ConversionRuler tracking: Non-JavaScript Version
Tracking using ConversionRuler in browsers which do not have JavaScript enabled is as straightforward as displaying the <noscript>
tags conditionally when a cookie is received by the server software.
Requirements
- A server-side scripting environment
- The ability to check cookies sent to the server
- The ability to conditionally output page HTML based on the value of the cookies sent
Implementation
Using your server-side language, the code would appear as follows:
<?php if (isset($_COOKIE['consent']) && $_COOKIE['consent'] === '1') { $siteid = 'SITEID'; echo '<noscript><div style="position: fixed; left: 0; top: 0"><img src="https://www.conversionruler.com/bin/tracker.php?siteid=${siteid}&nojs=1" alt="" width="1" height="1" /></div></noscript>'; }
The quick explanation is that the server-side code checks to see if the consent
cookie is set, and if it is, then it outputs the <noscript>
to enable tracking.