Quickstart

With this quickstart guide, we’ve tried to make it as easy as possible to get up and running with Indent.

We’ll start with an overview of Indent and then jump start your integration with a step-by-step guide and code samples. You’ll want to set up your account before getting started.

Indent is broken up into three primary functions: Audit, Respond and Manage.

This quickstart covers how to send data to Indent for Audit that can then be used for Respond (alerting when something suspicious happens) and Manage (changing who can access what).

First, you’ll need to create your space:


If you didn’t create an Input as part of setting up your space, you’ll need to create one:


Once you’ve created your Input, you’ll be presented with your DSN (data source name) that looks like:

https://write.indentapis.com/v1/03952531e44a14edd927dd024912f93a1

This is where you’ll send events from your apps or servers over HTTP as a POST request.

If you wanted to send an audit event for every page view on your website, you’d send a page_viewed event with the current URL.

import { audit } from '@indent/audit'

audit.init({
  dsn: 'https://write.indentapis.com/v1/ZG9jcy1leGFtcGxl'
})

audit.write({
  event: 'page_viewed',
  actor: { id: window.analytics.user().anonymousId() },
  resources: [{ kind: 'http/url', id: window.location.href }]
})

You can also use the @indent/audit package to write audit events server-side:

import { audit } from '@indent/audit'

audit.init({
  dsn: 'https://write.indentapis.com/v1/ZG9jcy1leGFtcGxl'
})

// currentUser loaded separately in your code
// as part of request handling middleware

audit.write({
  event: 'page_viewed',
  actor: { id: currentUser.id, email: currentUser.email }
  resources: [{ kind: 'http/url', id: window.location.href }]
})

To see this all in an example, see our Next.js example: (requires npx)

npx create-next-app --example with-indent

Open the pages/_app.js file to add your DSN where it says INPUT_DSN:

import App from 'next/app'
import Router from 'next/router'
import { audit } from '@indent/audit'

audit.init({
  dsn: 'https://write.indentapis.com/v1/ZG9jcy1leGFtcGxl'
})

export const pageview = url =>
  audit.write({
    event: 'page_viewed',
    resources: [
      {
        kind: 'http/url',
        id: url
      }
    ]
  })

if (typeof window !== 'undefined') {
  pageview(window.location.href)
}

Router.events.on('routeChangeComplete', url => pageview(url))

export default App