Skip to main content

Documentation Index

Fetch the complete documentation index at: https://revlytics.co/docs/llms.txt

Use this file to discover all available pages before exploring further.

Goals let you define specific user actions and measure how often visitors complete them. Each goal tracks a conversion rate against total sessions, giving you a clear picture of how effectively your site drives key outcomes.

Goal types

Revlytics supports two types of goals:

Page Goals

Track when a visitor reaches a specific URL path. Useful for measuring visits to signup pages, pricing pages, thank-you pages, etc.
/pricing
/signup
/docs/**
/blog/*
Wildcard patterns:
  • * matches a single path segment — /blog/* matches /blog/my-post but not /blog/2024/my-post
  • ** matches across multiple segments — /docs/** matches /docs/api/v2/intro

Event Goals

Track when a custom event with a specific name is fired. Useful for measuring signups, purchases, button clicks, or any action you track with revlytics.track().
signup
purchase_completed
newsletter_subscribe
Event goals require you to fire custom events using the JavaScript API or HTML attributes. See Custom Events for setup instructions.

Setting up goals

Step 1: Track the action

Before creating a goal, make sure the underlying action is being tracked. For page goals, no setup is needed — Revlytics automatically tracks all pageviews. For event goals, fire custom events using one of these methods:
// On a signup form submission
revlytics.track("signup", { plan: "pro" });

// On a purchase
revlytics.track("purchase_completed", { value: 49 });

Step 2: Create the goal in your dashboard

  1. Go to Dashboard → Goals
  2. Click Create Goal
  3. Choose a goal type (Page or Event)
  4. Enter the path pattern or event name
  5. Optionally add a friendly name (auto-generated if left blank)
The create form provides autocomplete suggestions based on actual paths and events seen on your site.

Step 3: Monitor conversions

Each goal card displays:
  • Conversions — Number of unique sessions that completed the goal
  • Conversion Rate — Conversions divided by total sessions, shown with a visual progress bar
Click a goal card to expand it and view the individual converted sessions, including entry/exit pages, referrer, device, duration, and timestamp.

HTML attribute tracking

Add data-revlytics-event to any HTML element to track clicks as goal events:
<button data-revlytics-event="signup_click">
  Sign Up
</button>

Adding properties

Use data-revlytics-prop-* attributes for additional data:
<button
  data-revlytics-event="plan_selected"
  data-revlytics-prop-plan="pro"
  data-revlytics-prop-price="29"
  data-revlytics-prop-billing="monthly"
>
  Choose Pro
</button>
This fires a custom_event with:
{
  "event_name": "plan_selected",
  "properties": {
    "plan": "pro",
    "price": "29",
    "billing": "monthly"
  }
}

DOM walking

The click handler walks up the DOM tree to find the nearest element with data-revlytics-event. This means you can place the attribute on a container:
<div data-revlytics-event="card_click" data-revlytics-prop-card="pricing">
  <h3>Pro Plan</h3>
  <p>$29/mo</p>
  <button>Select</button> <!-- clicking this triggers the event -->
</div>

Priority

Elements with data-revlytics-event are not tracked as regular button clicks. This prevents duplicate events — the goal event takes priority over auto button click tracking.

Example goals

Goal NameTypePatternUse Case
Visit PricingPage/pricingMeasure pricing page interest
Read DocsPage/docs/**Track documentation engagement
SignupEventsignupMeasure registration conversions
PurchaseEventpurchase_completedTrack revenue events
NewsletterEventnewsletter_subscribeMeasure email list growth

API reference

Goals can also be managed via the API:
# Create a goal
curl -X POST https://revlytics.co/api/goals \
  -H "Content-Type: application/json" \
  -d '{
    "site_id": "YOUR_SITE_ID",
    "name": "Signup",
    "goal_type": "custom_event",
    "match_event": "signup"
  }'

# List goals with conversion data
curl "https://revlytics.co/api/goals?site_id=YOUR_SITE_ID&days=7"

# Delete a goal
curl -X DELETE "https://revlytics.co/api/goals?id=GOAL_ID"
All API requests require authentication. You must be logged in and have access to the site.