DOM attributes
Report events automatically with data-insightflare-event attributes, without writing JavaScript.
Add data-insightflare-event to an element and InsightFlare reports an event when the user interacts with it. The script listens for clicks and form submissions at the document level, so it works for elements added later too.
Click events
<button data-insightflare-event="signup_click">Sign up now</button>This reports an event named signup_click when the button (or anything inside it) is clicked.
Add data
Use data-insightflare-event-<key> attributes for individual fields:
<button
data-insightflare-event="signup_click"
data-insightflare-event-plan="pro"
data-insightflare-event-source="pricing"
>
Sign up now
</button>This reports { plan: "pro", source: "pricing" } as the event data. Attribute values are always strings. A hyphenated suffix becomes a camel-case key, so data-insightflare-event-ad-slot="top" reports adSlot.
Use data-insightflare-event-data to supply a JSON object instead (or together with individual attributes; individual attributes win when a key appears in both):
<button
data-insightflare-event="signup_click"
data-insightflare-event-data='{"plan":"pro","source":"pricing"}'
>
Sign up now
</button>Invalid JSON, or JSON that is not an object, is ignored.
Form submissions
Set data-insightflare-event-trigger="submit" on a <form> to report when it is submitted:
<form
data-insightflare-event="contact_submit"
data-insightflare-event-trigger="submit"
data-insightflare-event-data='{"plan":"pro","source":"landing"}'
>
...
</form>The trigger defaults to click. The only other supported value is submit, and it applies to forms.
Outbound links
If Auto-track outbound link clicks is enabled in the site's tracking settings (it is off by default), clicking a link to another domain reports an outbound_click event with the url and domain of the target. See tracking settings.
Events reported this way follow the same limits and shared properties as track().