There are a few reasons you might want to add btt.js to a local page view – maybe you’re troubleshooting an issue on a webpage that doesn’t load btt.js (such as a preproduction environment) or want to test out some configuration rules before the BTT tag is deployed. You should still follow all the standard rules for implementing the BTT tag on a website for the best results, but if you want to test out btt.js on a page view locally then you can do so by going through the steps below:
- Open a website that is NOT currently tagged with btt.js (if the webpage is already tagged with btt.js, please see the note below)
- Open the developer tools (right-click on the page > Inspect, or F12, or Ctrl+Shift+i)
- Click on the "Console" tab (might be under the >> icon if your developer tools window is too small)
- Paste in the snippet below and press Enter to run it
Note: Please see our FAQ on how to find your site identifier is you do now already know the prefix.
// Replace SITEID below with the site's prefix
var jsElm = document.createElement("script");
jsElm.async = true;
jsElm.type = "text/javascript";
jsElm.src = '//SITEID.btttag.com/btt.js';
document.body.appendChild(jsElm);
*Please note, you will need to re-run this script if you navigate to a new full page turn.
If btt.js is already loading on the page with the desired site prefix, then you might want to instead test out your configuration change using Local Overrides. Instructions differ depending on your browser, but details on Local Overrides in Chrome can be found here.
If btt.js is already loading on the page but you want to use a different site prefix, then you will want to block the current tag first using the "Request Blocking" tab of the developer tools (or right-clicking that request in the Network tab and then selecting "Block request URL") and then run the snippet above with the desired site prefix.
Comments
0 comments
Please sign in to leave a comment.