Browser SDK reference

The script has a deliberately small surface: one tag, one kind of element, one function.

Script tag

AttributeMeaning
srcThe script address shown on your Integrations page.
data-loopYour publishable key. Public; works only on your verified domain.
asyncRequired. The script must not block your page.

Slot element

AttributeMeaning
data-loop-slotA name for the position, up to 64 characters. It appears in your placement report.
data-loop-sizeOptional. One of 300x250, 320x50, 320x100, 728x90, 970x250, 160x600. Makes the slot a banner.
data-loop-typeOptional. recommendation (default without a size), feed, or banner.

Tracking a conversion

name is a string of up to 40 characters. props is an optional flat object of strings, numbers and booleans. The call is ignored unless the current page load arrived through a unit.

loop('track', name, props?)

Behavior you can rely on

  • Runs once per page, however many times the tag is included.
  • Finds slots added later by client-side navigation.
  • Renders each unit in a closed shadow root: your CSS cannot affect it and it cannot affect your page.
  • Never throws into your page. Any failure ends with the slot empty and collapsed.
  • Reports through sendBeacon with text/plain bodies, so no preflight requests are made.

Debugging

Add data-loop-debug to a slot to open its shadow root for inspection in developer tools. In the network tab, the first request is to /v1/config; a 200 means the key and the domain match.

NextTroubleshooting →