Tag Implementation

Implementation

Log in to your AB Tasty account and get your personal snippet.

Synchronous sample example

<script type="text/javascript" 
        src="https://try.abtasty.com/3d09baddc21a365b7da5ae4d0aa5cb95.js">
</script>

Asynchronous sample example

<script> 
    (function (i, s, o, g, r, a, m) { 
    i["abtiming"] = 1 * new Date(); 
    a = s.createElement(o), 
    m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m) 
    })(window, document, "script", "//try.abtasty.com/3d09baddc21a365b7da5ae4d0aa5cb95.js"); 
</script>

The hash in the snippet will be your AB Tasty account identifier.

Best practices

Our tool needs to be executed quickly as it is going to evaluate its environment (URL, device, datalayer, content of the webpage) to know if it has to execute and display a campaign, resulting in a potential layout shift. That's why we recommend to implement our tag as high as possible on your website using the synchronous version to avoid any flickering effect (displaying the original website before the variant).

Putting it in the BODY or forcing him to run asynchronously will higher your risks of having a flickering effect, damaging the user experience on your website.

QA

Check from the network tab

The easiest way to QA your implementation is to have a look in the network tab of your browser. By filtering on the try.abtasty.com domain you should be seeing our tag being downloaded.

QA the tag using the network tab

By opening its preview tab, you will have its last update time and its version.

Date and version using the preview tab

Check for the JS object

When correctly executing, our tag creates an ABTasty JS object with useful variables and methods.

JS Object in the browser console

Check for the browser storage

If no storage restriction is set (consent management), the tag will automatically create cookies and entries in the local storage and session storage.

At any moment, you can check if consent for data storage and data collection has been granted by the current visitor. The following variable must be equal to true when consent has been given.

window.ABTasty.consentReady

Browser compatibility matrix

Our tag is compiled using the following Babel rule:

>0.5%, not ie 11, not op_mini all

Corresponding browsers list

Last updated

Was this helpful?