You can use the JS API to list all the popup campaigns. This may be handy in situations when you would like to fetch all campaigns and iterate them to decide whether they should be shown or not.
id
String
The identifier of the popup campaign
name
String
The name of the popup campaign
type
String
The trigger-type of the popup campaign
The JS API can be used to register callbacks to hook into the popup events. To register listener to a callback, use api.listen(callbackId, callbackFunction)
function.
Whenever customer has input their email address into a Nosto behavioral pop-up that asked whether they want to subscribe to an email newsletter.
String
The email address in the user input.
newsletter
String
Whether the user gave their consent to subscribing to a newsletter. E.g. either the popup prompting for the email address input was worded similarly to “Please enter your email address to subscribe to our newsletter:” or there was an explicit checkbox that the user checked to give their consent.
campaignId
String
The identifier of the popup campaign
type
String
The trigger-type of the popup campaign
error
String
Description of the error in the case the pop-up failed to open.
The customer can minimize a Nosto behavioral pop-up into a ribbon to be shown at the edge of the viewport. The pop-up is also changed to be shown in its minimized ribbon form after a page load is done after a pop-up has been shown.
This callback will be called whenever the ribbon is rendered onto screen after a page load.
campaignId
String
The identifier of the popup campaign
The customer can minimize a Nosto behavioral pop-up into a ribbon to be shown at the edge of the viewport. This callback will be called when the customer clicks the minimize button on the pop-up.
campaignId
String
The identifier of the popup campaign
The customer can minimize a Nosto behavioral pop-up into a ribbon to be shown at the edge of the viewport. When they click on this ribbon, the pop-up will be maximized again to be shown in full size. This callback will be called when the customer clicks the ribbon to maximize the pop-up.
campaignId
String
The identifier of the popup campaign
The customer can click a “close permanently” button or link in a Nosto behavioral pop-up to dismiss the pop-up permanently. This callback is called when the customer clicks on that button or link.
campaignId
String
The identifier of the popup campaign
The callback will be called when a customer clicks a button inside a Nosto behavioral pop-up to get their discount coupon code.
campaignId
String
The identifier of the popup campaign.
couponCode
String
The trigger-type of the popup campaign.
origin
String
Where the coupon code originated from. Always popup
.
error
String
Description of the error in the case the pop-up failed to open.
The callback will be called when a customer clicks a button inside a Nosto abandoned cart pop-up to get an abandoned cart email.
sent
boolean
A boolean indicating whether the email was sent
campaignId
String
The identifier of the popup campaign
String
The email address to which the email was sent
message
String
Any error messages relating to the email sending
You can use the JS API to conditionally enable or disable a popup.
The following snippet enabled the specified popup.
id
String
✔
The identifier of the popup campaign
The following snippet disables the specified popup.
id
String
✔
The identifier of the popup campaign
You can open up a Nosto behavioral pop-up by calling the api.openPopup()
function. The first argument of the function is the ID of the popup campaign whose pop-up you want to show. The pop-up campaigns, including the pop-up templates themselves, are created in the Nosto Administration UI
Please note that some campaigns have active trigger types and can be opened automatically. If you want to use only the api.openPopup()
call to open pop-ups, please create the respective campaigns using the JavaScript API pop-up trigger type.
You can also give a second, optional argument to the api.openPopup()
function. The second argument is an object with the following fields:
effects
Read-Only
Describes the effects that should be used displaying the pop-up. If given, overrides the effects set up for the campaign in the Nosto Administration. See below for the description of the effects object.
preview
boolean
If true, an actual discount coupon won’t be given and the pop-up display won’t count in the analytics. Use this to preview the pop-up on your site.
overlayOpacity
number
0.8
How opaque, or non-transparent, the background should look like when showing the pop-up. Value can range from 0.0 to 1.0
fadeInDelayMs
number
0
How many milliseconds to take to fade in the pop-up.
In the event that you are using Nosto's Onsite Popups, you can leverage the JS API to build complex interactions with the popups.
See the following articles on how to use the JS API to interact with popups: