All Collections
Nextsale
Customize campaigns
Activate JS Trigger on Popup campaigns
Activate JS Trigger on Popup campaigns

Learn how to activate JS trigger on popup campaigns.

Neo Gurbanli avatar
Written by Neo Gurbanli
Updated over a week ago

As soon as the Nextsale JS SDK is being loaded in the page it registers the global JS variable called nsio. You can access this variable directly or as a property of the global window object (window.nsio).

nsio object has several public methods. For Promo Popup JS trigger functionality, you need to use the public nsio.trigger() method. This method requires only a single parameter and it's the ID of the campaign. You can get the ID of the campaign from the address of the browser (URL) bar after saving/publishing the campaign for the first time.

Basic implementation example:

var campaignId = 0; // YOUR CAMPAIGN ID$('#button').on('click', function(){     // It's recommended to check the existence     // of the nsio object before using it    if (window.nsio) {        nsio('trigger', campaignId);    }});
Did this answer your question?