Custom Tags
Custom tags cover Tag Manager actions that push custom data, call external pixel URLs, run sandboxed HTML, or run JavaScript in the page context.
Nitoriq supports four custom tag types:
Custom EventCustom ImageCustom HTMLCustom JavaScript
Custom Event
Custom Event pushes an event into the Nitoriq data layer.
The tag renders Event Name and each payload value, then pushes an object that
includes:
{
event: "event_name",
_niqSourceTagId: "tag_id",
...payload
}Custom-event triggers can listen for the pushed event name. Trigger conditions
can read event fields such as event.name, event.type, and
event.value.KEY.
Custom Image
Custom Image fires a pixel-style request by creating a browser image request
to the configured URL.
The URL supports templates. Optional query parameters are appended after the URL
is rendered. Fire Once prevents the same tag from firing more than once during
the page load.
Custom HTML
Custom HTML runs HTML inside a sandboxed iframe.
The iframe uses sandbox permissions for scripts, and can optionally allow forms
and popups. Inject Context sends Nitoriq context and resolved variables into
the iframe. Keep Alive keeps the iframe mounted instead of removing it
shortly after execution.
The sandbox bridge exposes helper functions inside the iframe, including
window.niq_push, window.niq_emit, window.niq_result,
window.niq_log, and window.niq_request_conversion.
Don’t use Custom HTML for analytics or advertising pixels such as Google
Analytics, the Meta Pixel, or the TikTok Pixel. The iframe is isolated from
your page, so a pixel running inside it can’t store its cookies, reports the
iframe instead of the real page URL, and loses the referrer. Every visit would
look like a new visitor on a blank page. Use an
advertising or analytics tag
such as Meta Pixel instead. For a platform that doesn’t have one yet,
install its snippet on the page directly or use a Custom JavaScript tag.
Custom JavaScript
Custom JavaScript runs JavaScript in the page context.
The code receives context, window, document, and tm arguments. When
Inject Context is enabled, context.vars contains resolved variables and the
context also includes Nitoriq identifiers when they are available. Fire Once
prevents repeated execution for the same tag during the page load.
context.push(event) pushes into the Nitoriq data layer. context.emit(event)
emits a runtime event such as a conversion.
Custom tag fields
Event Name
The event name pushed by a Custom Event tag.
Custom-event triggers match this name.Payload
Key/value data pushed with a Custom Event tag.
Trigger conditions and variables can read event payload values.Image URL
The URL loaded by a Custom Image tag.
The browser creates an image request to this rendered URL.Inject Context
Adds Nitoriq context and resolved variables to Custom HTML or Custom JavaScript execution.
Custom code can use current container, trigger, page, variable, and Nitoriq context.Keep Alive
Keeps a Custom HTML sandbox iframe mounted after execution.
The iframe remains available for snippets that need to stay active.Fire Once
Prevents a Custom Image or Custom JavaScript tag from running more than once during the page load.
The runtime skips repeated fires after the tag has already run once.A custom tag is represented when
- the selected custom tag type matches the runtime action
- required fields are filled in
- payload, parameter, URL, or code templates reference existing variables or built-in variables
Inject Context,Fire Once, iframe, and acknowledgement settings reflect how the tag should execute- one or more triggers are selected
- the container is published when the installed script should receive the tag
Was this page helpful?