Script snippet
Add Trodo to any site with a single script tag in the head. Zero build.
The fastest way to add Trodo: drop a script into your page's <head>. It loads the browser SDK, starts a session, and (with auto-events) captures page views, clicks, forms, and more before you write any tracking code.
Install
Add this to your <head>, as early as possible:
<script>
var script = document.createElement('script');
script.src = 'https://cdn.trodo.ai/scripts/analytics/trodo.script.min.js';
script.setAttribute('site-id', 'YOUR_SITE_ID');
script.setAttribute('auto-events', 'true');
document.head.appendChild(script);
</script>Replace YOUR_SITE_ID with the value from the Integration Manager.
Configuration
| Attribute | Description |
|---|---|
site-id | Required. Your site identifier. |
auto-events | Set to true to auto-capture page views, clicks, forms, errors, and more. Omit to disable. |
auto-events-disabled-paths | Comma-separated paths to exclude, e.g. /admin,/internal. |
auto-events-disabled-events | Comma-separated auto-event names to disable. See Auto-capture. |
Use the global Trodo
Once it loads, a global Trodo object is available everywhere:
Trodo.track('signup_completed', { plan: 'pro' }); // a custom event
Trodo.identify('user_123'); // who the user is
Trodo.people.set({ plan: 'pro', company: 'Acme' }); // persistent traitsThe browser SDK is stateful: after identify, the distinct ID is remembered, so later calls attribute to that user automatically.
Next
- Events for
track - Identity to attribute activity to users
- Auto-capture to tune what's captured automatically