Page events and HTML hooks

Listen in your page for a campaign being shown, closed or signed up on, place an inline campaign, and open a campaign from your own link or button.

The script talks to your page in two ways: it sends events on window that your code can listen for, and it reads a few HTML attributes that you add.

Events on window

  • tafsee:ready: the script has loaded your campaigns.
  • tafsee:show: a campaign was drawn.
  • tafsee:view: it was really seen.
  • tafsee:spin: a wheel was spun.
  • tafsee:coupon: a per-visitor code arrived. The code is in detail.code.
  • tafsee:conversion: a visitor signed up or reached the goal.
  • tafsee:close: a campaign was closed.
  • tafsee:error: something went wrong while loading.

The events about a campaign carry the campaign's id and the version's id in detail.

window.addEventListener('tafsee:conversion', function (event) {
  console.log('Signed up on campaign', event.detail.campaignId, 'version', event.detail.variantId);
});

The app shows this listener, ready to copy, on a website's page under For developers: the sign-up event.

Place an inline campaign

<div data-tafsee-inline="YOUR_CAMPAIGN_ID"></div>

The campaign is drawn inside this element. With data-tafsee-inline="auto" the element takes the first inline campaign that has no place of its own.

Open a campaign from a link or a button

<button data-tafsee-show="YOUR_CAMPAIGN_ID">Get the offer</button>
<a href="#tafsee-show-YOUR_CAMPAIGN_ID">Get the offer</a>

A click opens the campaign whatever its rules and frequency say. For any other element, use the condition Click on element with a CSS selector.

Tell the script about your own events

Send a named event with TafseePopup.track('your-event') and use the condition JavaScript event with the same name. See JavaScript API.

Ids for styling and tracking

Each block in the editor has an id on its Advanced tab. A campaign can also carry its own CSS and JavaScript; see Campaign settings and custom code. The popup is drawn in a shadow root, so CSS from your site's stylesheet does not reach inside it.

The data layer

On a page with a tag-manager data layer, two events are pushed there as well. See Tag manager and analytics events.

If it does not work

  • Your listener never runs: it was added after the event happened. Add it before the install code, or early in the page.
  • The inline campaign does not appear: the id in the attribute is not that campaign's id, or the campaign is not published.
  • The link opens nothing: the page does not carry the install code.

Related

Last updated: October 12, 2026

Lead Generation

Tafsee Popup

Popups, spin-to-win wheels, countdown bars and exit-intent offers for any website — in English and native Arabic.

⚡ Native Arabic, never priced by pageviewsBilingual supportFree plan · 14-day trial
+966 58 267 6110+966 58 267 6110