Skip to content

Campaign JavaScript Callbacks

JavaScript callbacks run your own code when something happens in the campaign. You find them under JavaScript Callbacks on the campaign’s Publish tab. A developer usually writes the code.

Runs your JavaScript when the campaign shows.

Runs your JavaScript each time a visitor submits a step of the campaign, and when a visitor presses a button set to count as a conversion (Counts As on the Button component).

Runs your JavaScript when the campaign closes: its close button, a button set to close, an automatic close or an opened link. It does not run when the visitor leaves the page.

Runs your JavaScript each time a visitor clicks a button that opens a link, and when they start a game.

To see campaign activity in Google Analytics, push an event to the data layer from each callback. Replace campaign-identifier with a name for the campaign.

dataLayer.push({
event: 'interaction',
category: 'Fluentos Campaign',
action: 'Impression',
label: 'campaign-identifier',
})
dataLayer.push({
event: 'interaction',
category: 'Fluentos Campaign',
action: 'Submit',
label: 'campaign-identifier',
})
dataLayer.push({
event: 'interaction',
category: 'Fluentos Campaign',
action: 'Close',
label: 'campaign-identifier',
})