Developers » AS2 tagging » JavaScript » Users » Respecting data privacy 5.11.0
Respecting data privacy
Foreword
So that you can respect user privacy and be in accordance with the regulations in different countries, the tracker allows you to disable user tracking.
This feature is available since version 5.11.0
No consent to be tracked
Depending on the legislation in force, it may be necessary to indicate that the user has not yet consented to be tracked by our solutions via a cookie. To do this, simply set disableCookie
to true
when initializing the Tracker.
Hits will nonetheless be sent. Only the idclient variable enabling use tracking will contain the value “Consent-NO”
Example
var tag = new ATInternet.Tracker.Tag({disableCookie: true});
Disabling user tracking (opt-out)
If your web site offers a page allowing the user to enable or disable statistical tracking, you can save this information via the global ATInternet.Utils.userOptedOut method.
Hits will nonetheless be sent. Only the idclient variable enabling use tracking will contain the value “OPT-OUT”.
To change this behavior, you can use the configuration key sendHitWhenOptOut available since version 5.14.0 of the Tracker. By passing the value to false (true by default), you will prevent the hits from being sent when the user is in “OPT-OUT” mode.
var config = { sendHitWhenOptOut: false }; var tag = new ATInternet.Tracker.Tag(config); // Tracker is now preventing hit from being sent when the user is in "OPT-OUT" mode
Examples
- Disabling user tracking
ATInternet.Utils.userOptedOut(); var tag = new ATInternet.Tracker.Tag(); tag.page.set({ name: 'pageName', customObject: { MyPageLabel: 'my_page', MyChapters: {level1: 'my_chapter1', level2: 'my_sub_chapter1', level3: 'my_sub_chapter2'} } }); tag.dispatch();
- Recovering user tracking status
var isOptedOut = ATInternet.Utils.isOptedOut(); // true or false
- Re-enabling user tracking
ATInternet.Utils.userOptedIn(); var tag = new ATInternet.Tracker.Tag(); tag.page.set({ name: 'pageName', customObject: { MyPageLabel: 'my_page', MyChapters: {level1: 'my_chapter1', level2: 'my_sub_chapter1', level3: 'my_sub_chapter2'} } }); tag.dispatch();