Hubspot Opt-out Script for Data Policy page


#1

We need help in the implementation of Hubspot cookie opt-out script. There is an article on the Hubspot Developers Page about Hubspot cookie opt-out: https://developers.hubspot.com/docs/methods/tracking_code_api/place_do_not_track_cookie
We want to use the opt-out possibility for Hubspot Cookies on our Data Policy page. Like you can use opt-out possibilities for example for Google Analytics or other tracking systems, which looks for a user like a simple click on a link in the Data Policy "deactivate Google Analytics Cookies". Would you please provide an exact snippet (e.g. Java-Script, iframe) for the implementation in our CMS system? We use Typo3 and Wordpress. For Wordpress the java-script solution probably wil not function. so we need an alternative. It would be nice if step-by-step instruction of the implementation for different cms systems were provided.
Best Regards
Julia


#2

Hi @iuliia.ceyhan,

The snippet included on the developer documentation link you provided will work in Javascript:

document.getElementById("doNotTrack").onclick = function() {
    _hsq.push(['doNotTrack']);
};

For another implementation, you'll need to consult with your development team.


#3

Hello @Derek_Gervais,
no, it doesn't work. If we put exactly the Code:
document.getElementById("doNotTrack").onclick = function() { _hsq.push(['doNotTrack']); };
as an HTML-element in typo3 it is shown online exactly like this as a text :document.getElementById("doNotTrack").onclick = function() { _hsq.push(['doNotTrack']); };
We Need a Code like for examle for Google Analytics:
Google Analytics deaktivieren
This Code works and Looks online on the page like a text with a link saying "deaktivate Google Analytics", upon clicking on it the GA Cookies are switsched off.


#4

Hello @Derek_Gervais,
no this Code doesn'T work. If you use this Code exactly like you provide it and insert as an HTML- element to typo3, it is shown online exactly in the same way like a Code.
We Need smth like Google Analytics opt-out Code:
Google Analytics deaktivieren
This Code Looks like a text with a link and upon clicking on it the user turns off the GA Cookies.


#5

<a onclick="alert('Google Analytics wurde deaktiviert');"

href="javascript:gaOptout()">Google Analytics deaktivieren

Example of Google


#6

Hi @iuliia.ceyhan,

I'm sorry I wasn't entirely clear; I didn't mean to imply that the example from the docs was plug-and-play. The example will target a button with the id doNotTrack and trigger the doNotTrack method. You'd need to have a button or element with an id of doNotTrack for that to work.

You can do something like this if you're copy/pasting into an HTML element:

<a id="doNotTrack">Click here to trigger 'doNotTrack'</a>
<script>
  document.getElementById("doNotTrack").onclick = function() {
    _hsq.push(['doNotTrack']);
  };
</script>

To clarify; this is just a piece of example code to help you out with your implementation. This example does not automatically make you compliant, and more generally I'm unable to advise you on compliance. It's important to consult with your own legal counsel for help with compliance.


#7

Hello @Derek_Gervais, I have tried the script you suggested - it is shown on the page like a clickable element (link), but on the page you cannot click on it. So the opt-out function doesn't work like this in this case. Did you test it or implement on other Webpages as an opt-out-link?


#8

Hi @iuliia.ceyhan,

I did some brief testing on a test page that I use; things seemed to function correctly there. I would recommend contacting someone in your org (e.g. webmaster/developer/IT person) for help with your specific implementation of this tracking code method. While I'm happy to answer any specific technical questions regarding the Tracking Code API, I'm not the best resource for writing any code that's to be used in a production environment.