Enhance your Pop-ups & Product Widgets with JavaScript

22.12.2021
access_time
5
min

If classic pop-ups and product widgets are too restrictive for you in terms of graphics or functionality, Samba Enterprise users can now take advantage of our newest tool, the Script Manager, which allows for the inclusion of custom scripts that provide enhanced features.

Through the utilization of the same Samba tracking scripts already in place for standard Samba functionality, the Script Manager allows for easy creation and execution while requiring no additional installation or integration.

That means, once you’ve created your script and added it to Samba, you can quickly insert it into your pop-ups and widgets with no need for any modifications to your existing e-shop code. Script Manager manages, for lack of a better word, all of your custom JavaScripts, including testing, sharing, and the ability to modify the scripts on-the-fly.

Like Google Tag Manager, Samba’s Script Manager relies on only one code for the e-shop, but then allows for the inclusion and operation of various scripts that can be altered independently, as needed.

To give you an idea of how it works, we’ve prepared a simple use case and accompanying solution below, including the pre-programmed script template that you can readily use yourself in Samba Enterprise.

Use Case: Exit Intention

From all of the customers that come to your site, very few will actually make a purchase or even put items in their cart. While frustrating, there are various steps you can take to make up many of those lost sales.

The aforementioned pop-ups are a great example of a viable feature businesses can use to get right in front of their customers and make them reconsider leaving. To accomplish this, JavaScript coding would actually trigger an Exit Intention pop-up when a shopper would move their mouse cursor above the webpage content, which would typically indicate they were going to either close the page, change to a new address, or click a new tab.


Samba’s Script Manager allows for the easy management and execution of scripts like these where the only variable is what you want to communicate. For our example, when people are looking to exit, there are 3 viable things you can do:

  • Provide a discount or coupon code in an effort to keep them shopping
  • Offer them free shipping, which is one of the most attractive things for a shopper
  • Request their email address in exchange for those same discounts and free shipping, plus many other subscriber benefits

As is the case with all standard Samba pop-ups, those executed via the scripts in the Script Manager can contain custom graphics and texts, which can all be changed at will.

Getting Started

To give you an idea of how it is to access and work with the Script Manager in Samba Enterprise, we’ll go through the steps of setting up your own custom scripts for an Exit pop-up that will offer a special offer to keep them shopping.

To get started, click on “Script Manager” from the main navigation menu on the left-hand side of the admin panel. From here, we can see all of our existing scripts and create and/or test new ones. For now, we’ll create a new script “container” by clicking on “+ Add Container”


A window, containing the settings of the container, will then appear and we’ll be able to enter a name for the container and include the script.


Once completed, we can close the window and test it by clicking the “Test” button located on the right-hand side of the container’s box. When pressed, the script will run in test mode, so it can easily be debugged until it’s perfect for deployment on our e-shop.

The status indicator (“Draft” in the image above) displays the stage of the container and whether or not it’s in testing.  as well as easily and quickly remove individual containers from testing and possibly publish them.


By clicking the carrot, you will see an option to “Share” the container, which will produce a unique URL that you can pass along to others on your team so they can see the script in action in their own browser. Please note, it’s recommended that you use an Internet browser in incognito/private mode for smooth functionality. To read more about this and how testing works, please have a look at our documentation.

Moving Forward

To help get you going, we’ve put together a sample container (Exit pop-up) that you can start using today. While our sample Exit pop-up only displays a simple discount offer and some buttons for closing and continuing (returns them to the e-shop), with more complex JavaScript code you can create even more advanced and dynamic pop-ups.

For example, you can include free shipping, discount codes, links to download files or eBooks, and much more. Most importantly, through the offer and subsequent call to action, you’re most probably collecting that all-important email address, opening up future opportunities for targeted and personalized email marketing.

In the end, it’s up to you which marketing approach you take with the pop-up and whatever you choose to do is better than the alternative of letting those lost sales stay lost. To help get you inspired, here are some Exit pop-ups from real websites:


Stay on top of all the latest news by subscribing today.

Přihlášením k odběru získáte přehled o všech novinkách.

Bądź na bieżąco z najnowszymi wiadomościami, subskrybując je już dziś.