Documentation

create_custom_event_rule

Creates a tracking rule. The storefront tracker picks it up within about 60 seconds and starts firing the event — no theme edit required.

Needs Growth or higher for dataChanges store configuration

When to use it

Once test_custom_event_rule confirms the selector matches what you intended. Then call list_custom_event_rules to confirm the rule is live.

Ask for it like this

You do not name the tool. These are questions that make an assistant reach for it:

Start tracking clicks on the size chart button.

What will make you wrong

Caveats

  • Event names are 1 to 100 characters, letters, digits, underscore, hyphen, period and colon only.
  • staticProperties is capped at 50 keys and 10KB.
  • A store may hold at most 100 rules.

Parameters

eventName
stringrequired
The event name, for example size_chart_opened.
triggerType
enumrequired
click fires on any matching element clicked, submit on form submission, visible when the element scrolls into view.
clicksubmitvisible
cssSelector
stringrequired
The selector the rule watches, for example .size-chart-btn or #newsletter-form.
pageUrlPattern
string
Restrict the rule to pages whose URL matches this SQL LIKE pattern, for example %/products/%.
staticProperties
object
Static properties attached to every event this rule fires.

Shared parameters it accepts

None. This tool is not date-scoped — it reports current state rather than a window.

Every tool also accepts merchantId, which resolves from your connection. You never pass it.

What comes back

JSON. These are the top-level keys; date-scoped tools additionally carry a _meta block with the server date and the data coverage envelope.

success
false with an error string when validation fails.
ruleId
The new rule's id, for list and delete.
description
Confirmation, including the propagation delay to the storefront.

Pairs with