Essentials

To get started with Tweakwise JS using Plugin Studio, add your personalized JavaScript file to the page.

Installation

Copy the following code into the <head> of your HTML, before scripts like Google Tag Manager. This contains Event Tag and the essentials that contain our different plugins to control the different parts of your platform.

<link rel="preload" as="script" href="https://gateway.tweakwisenavigator.net/js/starter.js" />
<link rel="preload" as="script" href="https://gateway.tweakwisenavigator.net/js/INSTANCEKEY/tweakwise.js" />

<script>window["twn-starter-config"] = window["twn-starter-config"] || {};</script>

<script>
  window.tweakwiseFailover = function (src) {
    var script = document.createElement("script");
    script.async = true;
    script.src = src;
    document.head.appendChild(script);
  };
</script>

<script
 src="https://gateway.tweakwisenavigator.net/js/INSTANCEKEY/tweakwise.js"
 data-failover="https://gateway.tweakwisenavigator.com/js/INSTANCEKEY/tweakwise.js"
 onerror="window.tweakwiseFailover(this.dataset.failover)"></script>

<script>(function(w, d, l, i, u) {w['_twa'] = l;w[l] = w[l] || [];w[l].push({ 'twa.start': new Date().getTime(), event: 'twa.js' });w[l].push({ 'twa.instance': i, event: 'twa.init' });var f = d.getElementsByTagName('script')[0],j = d.createElement('script');j.async = true;j.src = u;f.parentNode.insertBefore(j, f);
})(window, document, 'tweakwiseLayer', 'INSTANCEKEY', "//navigator-analytics.tweakwise.com/bundles/scout.js");</script>

Important: after you have added the snippet to your frontend replace INSTANCEKEY with your own instance key. You can find your instancekey in the App Dashboard.

Notes

  • Besides importing the JavaScript file the snippet tells the browser that the plugin should be loaded with a high priority.
  • It also creates a fallback mechanism to an alternative domain. This is done to optimize the performance and stability of the solution.
  • When Tweakwise JS has loaded, it will begin to process the twn-starter-config configuration object. Any changes to the object after initialisation will not have effect.
  • The twn-starter-config configuration object is also for Suggestions JS, Recommendations JS and Guided Selling JS.
  • Important: place the snippet before Google Tag Manager for better performance.

Plugin Studio

In Plugin Studio you can manage everything related to your Tweakwise JS implementation.

💡

Access Plugin Studio from the main menu in the Tweakwise app

If Plugin Studio isn't available in the Tweakwise menu, please contact Tweakwise Support to activate it.

Click on one of the following topics to learn more: