Analytics · Advanced Topics · Bookmarklets

Onesecondbefore has created support for Bookmarklets. These work in all browsers and this makes testing and debugging of your tagging implementation easier.

Retrieve your Onesecondbefore user_id

In order to debug and test the Onesecondbefore tracking, you need to know you user_id in order to filter the hits out of the database. An easy way to retrieve it, is to run the following code in the JavaScript Console of your browser. It will log the user_id in the JavaScript Console

Bookmarklet

Drag & drop the following link to your bookmarks bar: Show OSB UID

Bookmarklet code

Or copy & paste the following code in the URL field of a bookmark.

javascript:if (typeof(osb)==='undefined'){alert('Onesecondbefore is not installed on this website!')} else {osb('uid', function(uid){prompt('Your Onesecondbefore User ID is:', uid)});}

(Re)Activate Preview Mode

When clicking on this Bookmarklet, you will activate the Preview mode. Before this happens, all cookies and local storage items of Onesecondbefore will be removed and the page will be reloaded.

Bookmarklet

Drag & drop the following link to your bookmarks bar: (Re)Activate Preview

Deactivate Preview Mode

When clicking on this Bookmarklet, you will deactivate the Preview mode. All cookies and localStorage items of Onesecondbefore will be removed and the page will be reloaded.

Bookmarklet

Drag & drop the following link to your bookmarks bar: Deactivate Preview

Bookmarklet code

Or copy & paste the following code in the URL field of a bookmark.

javascript:if (localStorage.getItem('_osb_preview')==='1'){localStorage.removeItem('_osb_preview');alert('Switched Off Preview Mode');}else{osb('clear');localStorage.setItem('_osb_preview', '1');alert('Switched On Preview Mode')}

Show the CMP

In some cases, you want to force Onesecondbefore to show the CMP again. If you click on this bookmarklet, it will be shown.

Bookmarklet

Drag & drop the following link to your bookmarks bar: Show CMP

Bookmarklet code

Or copy & paste the following code in the URL field of a bookmark.

javascript:osb('consent', {'show': true});

Show the IAB TCF v2 Consent String

If you would like to see the TC String, you can use this Bookmarklet to show it.

Bookmarklet

Drag & drop the following link to your bookmarks bar: Show IAB TC String

Bookmarklet code

Or copy & paste the following code in the URL field of a bookmark.

javascript:if (typeof(__tcfapi)!=='undefined') {__tcfapi('getTCData', 2, (tcData, success) => {if(success) {prompt('The TC String is:',tcData.tcString);} else {console.log('no succes');}},[1,2,3]);} else { alert('No TCF on this website!')}