Skip to main content

Overview

This guide gets behavioral analytics live quickly. By the end, you will have:
  • ✅ Automatic page, click, scroll, and form signals (when auto-events="true")
  • ✅ Session tracking via the SDK session model
  • ✅ Optional custom events for agent and product workflows
  • ✅ Data flowing to your dashboard

Prerequisites

  • A Trodo account (sign up here)
  • Access to your app’s HTML or frontend build
  • Your Site ID from the Trodo dashboard

Step 1: Get your Site ID

  1. Log in to app.trodo.ai
  2. Navigate to Settings → Sites
  3. Click Add Site or select an existing site
  4. Copy your Site ID

Step 2: Add the tracking script

Step 3: Verify installation

  1. Open your app in the browser
  2. Open developer tools (F12)
  3. Look for: [Trodo] Initialized successfully
  4. In the Trodo dashboard, open Live Events
  5. You should see events in near real time
Events can take up to about a minute to appear. If nothing shows after a few minutes, see Troubleshooting.

Step 4: Track custom events

Instrument the actions that define your product—especially agent runs, completions, and failures:
Trodo.track('agent_run_completed', {
  workflow_id: 'customer_summary',
  duration_seconds: 38,
  outcome: 'success'
});
See Track for the full API.

Step 5: Identify users

When someone signs in or you know their account ID:
Trodo.identify('user_12345');

Trodo.people.set({
  email: '[email protected]',
  plan: 'pro',
  signup_date: '2024-01-15'
});
Anonymous activity on that device attaches to this profile.

What is being tracked?

With auto-events enabled, the SDK emits a rich set of interaction events. Common examples:
EventDescription
page_viewLoad or SPA navigation
element_clickClicks with element context
rage_click / dead_clickFrustration and dead-end clicks
page_scrollIncreasing scroll depth
form_submitForm submits (metadata only)
text_selection / copy_actionSelection and copy signals
page_summaryAggregated engagement when leaving or hiding the tab
See Auto-Events for the full list and how to disable specific names or paths.

Example: complete setup

Minimal pattern for an AI product shell:
<!DOCTYPE html>
<html>
<head>
  <title>My App</title>
  <script>
    var script = document.createElement('script');
    script.src = 'https://cdn.trodo.ai/scripts/analytics/trodo.script.min.js';  
    script.setAttribute('site-id', 'my-app-42');
    script.setAttribute('auto-events', 'true');
    document.head.appendChild(script);
  </script>
</head>
<body>
  <script>
    function onAgentSuccess(workflowId, seconds) {
      Trodo.track('agent_run_completed', {
        workflow_id: workflowId,
        duration_seconds: seconds,
        outcome: 'success'
      });
    }

    function onLogin(user) {
      Trodo.identify(user.id);
      Trodo.people.set({
        email: user.email,
        plan: user.plan
      });
    }
  </script>
</body>
</html>

Troubleshooting

  1. Check the browser console for errors
  2. Verify Site ID and domain allowlist in Settings → Sites
  3. Load the script before interactions you care about
  4. Disable ad blockers temporarily while testing
  1. Check Content-Security-Policy rules
  2. Confirm the CDN URL
  3. Try the npm package if CSP blocks third-party script

Next steps

What to Track

Plan events for agentic journeys

Build your first report

Insights and metrics

User profiles

How profiles are built

SDK reference

Full API documentation