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)});}

Switch Preview Mode On or Off

When clicking on this Bookmarklet, you will switch the Preview mode On or Off.

Bookmarklet

Drag & drop the following link to your bookmarks bar: Preview On/Off

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{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});