Skip to main content
The tracking script adds the global function metricanicCallback to the page. Use it in your own scripts to connect buttons, read visit data and send events. The page needs the installed tracking snippet. See Install the tracking script. On Hosted landings, publish with Add Direct Tracking enabled.

Call a function

Put your code inside metricanicCallback:
The code runs after the visit is registered and the page’s offer links are connected. If tracking is already ready, it runs immediately. If tracking fails, it does not run. Place your code after the tracking snippet.

Functions

Connect buttons added later

When the page loads, the script connects links to https://<tracking domain>/click and elements with data-dtp-link, including buttons. After a popup, quiz or page builder adds buttons, call:
Call it again after each change. An element is never connected twice.

Build your own offer button

Use this when a button needs its own logic, such as form validation, before opening the offer:
Call registerClick() once per click. Do not use it on links the script already connects. They record clicks automatically.

Pass the click ID to a form

Save the click ID with the lead so your CRM can send events for this visit later:
Your CRM sends the event to the incoming event URL with this click ID.

Send an event

  • Configure the slot in the campaign’s Events and rules. See Decide what counts as a conversion.
  • Without txuid, every call adds a new event. Use a fixed txuid for steps that must count once, such as 'form-open'.
  • Visitors can see and change browser requests. Send revenue from your server or affiliate network instead.
  • logEvent() completes when the request is sent, not when the event is recorded. Check the result in Events.

Handle a failed start

The handler runs once if the script cannot load (script_load_failed) or the visit cannot be registered (invalid_response, visit_failed). Callbacks then do not run, and offer links keep their original addresses.