Skip to content
  • There are no suggestions because the search field is empty.

Active On Site Tracking Guide

Learn about the OIR SDK's automatic engagement tracking.

The Active On Site event is automatically collected by the SDK when a user stays on your website long enough to meet the configured time threshold. This event marks the start of the user's engagement journey and is triggered once per web session.

How It Works

  1. User lands on your website
  2. SDK starts tracking time on site
  3. When the user meets the minimum time threshold, the event fires
  4. Event is sent once per session (not on every page load)

Key Features

  • Automatic Collection: No manual implementation required
  • Time-Based Trigger: Only fires after the user meets the minimum time threshold
  • Session-Based: Triggers once per web session
  • Engagement Indicator: Identifies genuinely interested users vs. quick bounces
  • Cross-Tab Coordination: Only one tab sends the event

Use Cases

  • Engagement Analytics: Track users who spend meaningful time on your site
  • Conversion Funnel: Use as a starting point for conversion tracking
  • Audience Segmentation: Identify engaged users for remarketing campaigns
  • Content Performance: Measure which pages lead to longer engagement
  • Bounce Rate Analysis: Distinguish between quick bounces and engaged sessions
  • Active User Tracking: Identify users who are actively engaged

Benefits

  • Reduced Noise: Filters out accidental clicks and quick bounces
  • Quality Metrics: Focus on users who show genuine interest
  • Better Targeting: Create audiences based on engagement behavior
  • Improved ROI: Target users who are more likely to convert

Configuration

The time threshold is configured in your dashboard. By default, the event fires after 15 seconds of time on site.

Adding Custom Data

You can attach custom data to the automatic Active On Site event using global configuration:

window._oirtrk = window._oirtrk || [];

// Set global custom data that will be included in automatic events
window._oirtrk.push(['set', 'sessionId', getSessionId()]);
window._oirtrk.push(['set', 'customId', 'user_12345']);
window._oirtrk.push(['set', 'campaignId', 'summer_sale_2024']);
window._oirtrk.push(['set', 'userSegment', 'premium']);
 

This data will be automatically included when the Active On Site event fires.

Manual Implementation (Optional)

If you need to manually trigger this event (not recommended for most use cases):

_oirtrk.push([
'event',
{
event: 'on_site',
page_url: window.location.href,
page_title: document.title,
referrer: document.referrer,
// Custom fields
sessionId: getSessionId(),
customId: 'user_12345',
campaignId: 'summer_sale_2024',
},
]);
 

Custom Fields

You can include additional custom fields with the On Site event:

Category Examples
Session Data sessionIdsessionDurationsessionStartTime
User Identifiers customIdpuidcustomerId
Business Context campaignIdsourcemediumcontent
Technical Data deviceTypebrowserVersionscreenResolution

Note: Custom fields need to be registered in your dashboard before they can be used.

Migration from Previous Versions

If you're upgrading from a previous version of the SDK, you may have a manual on-site tracking snippet following your SDK loader. Since the SDK now handles on-site events automatically, we recommend removing this second script block.

Current setup (before migration):

<script type="text/javascript">
!(function (s) {
let o = s.createElement('script'),
u = s.getElementsByTagName('script')[0];
o.src = 'https://cdn.aggle.net/oir/oir.min.js';
o.async = !0;
o.setAttribute('oirtyp', 'YOUR_INTEGRATION_TYPE');
o.setAttribute('oirid', 'YOUR_INTEGRATION_ID');
u.parentNode.insertBefore(o, u);
})(document);
</script>
<!-- Remove this second script block -->
<script type="text/javascript">
!(function (e) {
let t = {
puid: '12345',
};
(e._oirtrk = e._oirtrk || []).push(['track', 'on-site', t]);
})(window);
</script>
 

Recommended setup (after migration):

<script type="text/javascript">
!(function (s) {
let o = s.createElement('script'),
u = s.getElementsByTagName('script')[0];
o.src = 'https://cdn.aggle.net/oir/oir.min.js';
o.async = !0;
o.setAttribute('oirtyp', 'YOUR_INTEGRATION_TYPE');
o.setAttribute('oirid', 'YOUR_INTEGRATION_ID');
u.parentNode.insertBefore(o, u);
})(document);
</script>
 

If you need custom data with the on-site event, use the set command instead:

<script type="text/javascript">
!(function (s) {
let o = s.createElement('script'),
u = s.getElementsByTagName('script')[0];
o.src = 'https://cdn.aggle.net/oir/oir.min.js';
o.async = !0;
o.setAttribute('oirtyp', 'YOUR_INTEGRATION_TYPE');
o.setAttribute('oirid', 'YOUR_INTEGRATION_ID');
u.parentNode.insertBefore(o, u);
})(document);

// Set custom data that will be included in automatic events
window._oirtrk = window._oirtrk || [];
window._oirtrk.push(['set', 'puid', '12345']);
</script>
 

See the Global Custom Data Guide for more details.

Why remove the manual tracking?

  • The SDK now automatically tracks on-site events
  • Manual tracking may cause duplicate events
  • Automatic tracking provides better timing and cross-tab coordination

    Note:
     Removing the second script block is recommended but not required. The SDK will handle both cases gracefully.

Troubleshooting

Event not firing?

  • Verify SDK is loaded and configured
  • Check if the user meets the time threshold
  • Ensure the event hasn't already fired in the current session
  • Check browser console for errors

Event firing too early/late?

  • The time threshold is configured in your dashboard
  • Contact your account manager to adjust the threshold

Next Steps