Add the ButtonJS Library to your Website

Overview

PostTap SMS is enabled with the ButtonJS library. You can install it on your website easily as an HTML script snippet. This is be done either by adding the snippet directly into your website's codebase, or with any Tag Manager you're already using.

Initialize the ButtonJS Library

To integrate ButtonJS, place the following code in your website somewhere between the <head> and </head> tags, as close to <head> as possible.

<script>
  window.ButtonWebConfig = {
    // Replace the value of applicationId with your Mobile Web App ID
    // from the Button Dashboard: https://app.usebutton.com
    applicationId: 'YOUR_APPLICATION_ID_HERE',
    // The following property is required
    enableSmsCollection: true
  };

  (function(u,s,e,b,t,n){u['__bttnio']=b;u[b]=u[b]||function(){(u[b].q=u[b].q||[]).push(arguments)};t=s.createElement(e);n=s.getElementsByTagName(e)[0];t.async=1;t.src='https://web.btncdn.com/v1/button.js';n.parentNode.insertBefore(t,n)
                        })(window, document, 'script', 'bttnio');
</script>

For proper implementation and tracking, the above snippet should be loaded on every page of your website.

As noted in the snippet above, be sure to replace YOUR_APPLICATION_ID_HERE with the one that can be found by logging in to the Button Dashboard: https://app.usebutton.com

This is the only step needed to enable SMS collection on your website. Any of the additional features of ButtonJS, like reporting Orders and Page Views, require the above snippet to be loaded first.

Testing Your Integration of ButtonJS

As stated above, if the steps in this guide aren't completed correctly, none of the other features in ButtonJS will be functional. To ensure you've done this step correctly, in your browser's address bar type in the following line and press ENTER:

yourwebsite.com?btn_ref=srctok-abcd1234

Be sure to replace yourwebsite.com with the website you've added ButtonJS to.

Then, in that same page, open the Javascript Console, and type in the following code and hit ENTER:

bttnio('getReferrerToken');

This should return the value of the btn_ref query string parameter value in the URL: srctok-abcd1234. If executing this Javascript code in the console returns anything other than the value of btn_ref, check the steps above again to make sure they were completed correctly.

If you continue to have issues, please reach out to your Customer Success Manager.


Did this page help you?