Track custom user actions (Goals)

Insightly allows you to track specific user actions beyond pageviews, known as Goal (signup, newsletter subscribe, checkout initiated, etc.).

You can track goals using three methods:

1. Client-side tracking (simple)

Add a JavaScript snippet where the conversion occurs (e.g., on a "thank you" page after signup, when a user clicks a button, etc.).

Basic usage

javascript
window?.insightly('goal_name');

Rules for
goal_name:

  • Use lowercase letters.
  • Numbers, underscores (_), and hyphens (-) are allowed.
  • Maximum 32 characters.

Rules for custom parameters:
goal_name:

  • Property names: lowercase letters, numbers, underscores (_), and hyphens (-) only. Max 32 characters.
  • Property values: any string, max 255 characters.
  • Limits: maximum 10 custom parameters per event.

2. HTML data attributes (simple)

Track goals automatically when users click on any element with the

insightly-goal
attribute. This is the simplest way to track button clicks.

Basic usage

html
<button insightly-goal='initiate_checkout'>Buy Now</button>

In this example Insightly will send a goal with the name .

initiate_checkout

Advanced usage with custom parameters

Add additional

insightly-goal-*
attributes to include custom parameters:

html
<button insightly-goal="pricing_plan_selected" insightly-goal-price="49" insightly-goal-plan-type="pro">
  Subscribe to Pro Plan
</button>

In this example DataFast will send a goal with the name

pricing_plan_selected
and
price: "49", plan_type: "pro"
custom parameters.