What is autocapture?

By default, Koala will automatically capture certain events on your website. This includes:

  • pageviews
  • form submissions
  • active session time
  • presence (when a user is active on your site vs idle)

This means that you don’t need to write any code to capture these events. Koala will automatically capture them for you. Whether you have a single page app or a traditional website.

Disabling autocapture

You can disable autocapture entirely by setting the autocapture option to false when you initialize the Koala pixel.

When loading from the CDN/script tag, add this before your script:

window.koalaSettings = {
  sdk_settings: {
    autocapture: false
  }
}

When using the NPM package, add this to your initialization:

import * as KoalaSDK from '@getkoala/browser'

let ko = null

// returns a promise containing the ko namespace object
KoalaSDK.load({
  // add your project's public key here
  project: 'pk_...',
  sdk_settings: {
    autocapture: false
  }
}).then(koalaSDK => {
  ko = koalaSDK
})

This will fully disable all autocapture of pageviews, form submissions, active session time, and presence.

Manually/programmatically enabling or disabling autocapture at runtime

You may want to enable or disable autocapture temporarily on some pages, for instance, if you are using Koala in a SPA that navigates seamlessly across your marketing site and product dashboard.

You can do this by calling ko.startAutocapture() and ko.stopAutocapture().

// start autocapture 
ko.startAutocapture()
// now, 
// pageviews will automatically be captured (including the current page immediately)
// form submissions will be captured
// active session time will be captured
// presence will be captured
// stop autocapture
ko.stopAutocapture()
// now,
// pageviews will not be automatically captured
// form submissions will not be captured
// active session time will not be captured
// presence will not be captured