GUIDE

Tracking goals

A goal is any conversion you care about — a form submit, a signup, a checkout start. Dupes counts them and attributes each to the visitor's channel and campaign.

1. Fire the goal

Two ways — an attribute needing no code, or a JS call. The attribute fires on click and on keyboard activation, so visitors who tab to a button and press Enter are counted too. Goal names are lowercased and limited to 64 characters.

<!-- No code: fires when clicked, or activated by keyboard -->
<button data-dupes-goal="signup">Sign up</button>

<!-- Optional detail, as data-dupes-goal-<name> -->
<button data-dupes-goal="purchase" data-dupes-goal-plan="pro">Buy</button>

<!-- In code: fire from anywhere, e.g. once a payment succeeds -->
<script>
  window.dupes("purchase", { plan: "pro" });
</script>

Optional: properties

Attach detail to a conversion — which plan, which form, which variant — with data-dupes-goal-<name> attributes or the second argument to window.dupes().

Invalid properties drop the whole conversion
Names must be lowercase a-z, 0-9, _ or -, up to 32 characters, and there is a limit of 10 per goal. Values must be text, numbers or true/false — not objects or arrays — and are cut at 255 characters. Break any of those and the conversion is not recorded at all, with an error in your browser console naming the offending property. Check the console after adding properties.

Optional: scroll goals

Some conversions aren't clicks. To count “they actually reached the pricing table”, mark the section instead — no click, no code.

<section data-dupes-scroll="saw_pricing"
         data-dupes-scroll-threshold="0.5"
         data-dupes-scroll-delay="1000">
  …
</section>

threshold is how much of it must be on screen (0 to 1, default 0.5) and delayis how long it must stay there in milliseconds — so scrolling straight past doesn't count. Fires once per page view; add data-dupes-scroll-repeat if you want it every time. Properties go on data-dupes-prop-<name> here, since data-dupes-scroll-* is taken by the settings above.

2. Define it in the dashboard

Open your site's Goals page and add a goal with the same event key (e.g. submit_form). Conversions then show up on your Overview with counts and unique visitors.

Common goals
  • initiate_form
  • submit_form
  • start_checkout
  • signup