Analytics · Advanced Topics · Bookmarklets

Onesecondbefore Analytics has a toolbox that allows you to debug and test your Analytics implementions. We use bookmarklets which ensures that you can use them in any browser. These work in all browsers and this makes testing and debugging of your tagging implementation easier.

How to get the bookmarklets in your browser

Drag & drop the links below to your bookmarks bar. You can also copy & paste the code in the URL field of a bookmark. In most cases the bookmarklets will only work if you have the Onesecondbefore Analytics JavaScript installed on the page. In some other cases, the bookmarklets will also work with other products than Onesecondbefore Analytics. We have the following bookmarklets:

Bookmarklets

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

When to use

This bookmarklet is useful when you want to see the user_id of the current user. You can use this to filter the hits in the database. The user_id is the same as used in the hits table. It only works when the Onesecondbefore Analytics JavaScript is installed on the page, otherwise it will show a message that Onesecondbefore is not installed.

(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

When to use

This bookmarklet is useful when you want to test the Onesecondbefore Analytics JavaScript before publising it. Before enabling the preview mode, it will remove all cookies and local storage items of Onesecondbefore and reload the page. The preview mode will be activated, which means that all hits will be sent to the sandbox environment (if you have one). You can use this to test your implementation of Analytics or our Consent Management Platform (CMP).

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

When to use

This bookmarklet is useful when you are done testing the Onesecondbefore Analytics JavaScript and you want to deactivate the preview mode. Before disabling the preview mode, it will remove all cookies and local storage items of Onesecondbefore and reloads the page.

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

When to use

This bookmarklet is useful when you want to show the Consent Dialogue again. It only works if you have one configured. It will detect which dialogue you have configured (gate or banner) and show it.

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!')}

When to use

This bookmarklet is useful when you want to see the TC String of the IAB TCF v2. It only works if you are on a website that has a TC String. This doesn't have to be the TC String generated by Onesecondbefore. It will show the TC String of the website you are on, whether it is generated by Onesecondbefore or any of the other IAB TCF suppliers.