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

AttributeDescription
site-idRequired. Your site identifier.
auto-eventsSet to true to auto-capture page views, clicks, forms, errors, and more. Omit to disable.
auto-events-disabled-pathsComma-separated paths to exclude, e.g. /admin,/internal.
auto-events-disabled-eventsComma-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 traits

The browser SDK is stateful: after identify, the distinct ID is remembered, so later calls attribute to that user automatically.

Next

On this page