Add a website

Indent enables you to easily collect audit logs from your Website.

  1. Sign into your Indent account.
  2. Create an Input with your website's name.

In your HTML file, add the following code above your </body> tag:

<script
  src="https://cdn.indent.com/v1/js/audit.js"
  data-input-dsn="https://write.indentapis.com/v1/ZG9jcy1leGFtcGxl"
></script>

Then in your code, you can write audit events like this:

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

If you have a website that uses modern JavaScript patterns like using Webpack, Parcel or Babel then you can use Indent through our JavaScript SDK:

yarn add @indent/audit

npm i -S @indent/audit

Then you can import the SDK in your code like this:

// ES Modules
import { audit } from '@indent/audit'

// CommonJS (e.g. older build systems and versions of Node.js)
const { audit } = require('@indent/audit')

At the root of your application, initialize the SDK with your INPUT_DSN:

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

Now you can write audit logs from anywhere in your application:

import { audit } from '@indent/audit'

audit.write({
  actor: { id: 'h0cECutqz', email: '[email protected]' },
  event: 'alarm.delete',
  resources: [
    {
      kind: 'alarm',
      id: 'very-important-alarm',
      altIds: ['owner/[email protected]']
    }
  ]
})