Operational

DocsGithub Open app

Operational

Github Articles Pitch Usecases Playground API

Contents

Start hereAPI DocsIntroductionSend your first eventEvent parametersStructured EventsActionsContextsCategoriesError handlingManualIntroductionBasicsConventionsSetupTest modeNotificationsPWASelf hostingIntroductionInstall locallyInstall on VPSInstall on RenderInstall via DockerInstall via Docker and CoolifyOnboardingSetup .envIntegrationsBest practicesOtherVisionRoadmapContributing

Sending structured events

You can pass various data formats and structured form objects to render better events.

Here’s an example for text event.

const e = {
  name: "some event",
  avatar: "🤖",
  content : 'This is some info about the event'
};
Copy

Note that you don’t explicitely need to pass type: ‘text’ since type is assumed to be ‘text’ by default.

Here’s another example with type json.

const e = {
  name: "some event",
  avatar: "🤖",
  type : 'json',
  content : {
    form_data_1 : 'something',
    form_data_2 : 'something else',
    obj : {
      nestedField1 : 1,
      nestedField2 : 'hmm'
    }
  }
};
Copy

Here’s another example with type image.

const e = {
  name: "some event",
  avatar: "🤖",
  type : "image",
    content : `https://images.unsplash.com/photo-1724026403614-f5461d17c6cc?q=80&w=3200&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D`
};
Copy

You can also stack different formats together. Use type ‘rows’ for this. Here’s an example.

const e = {
  name: "some event",
  avatar: "🤖",
  type : "rows",
  content : [
    {
      type : 'text',
      content : 'Some'
    },
    {
      type : 'text',
      content : 'text'
    },
    {
      type : 'text',
      content : 'Here'
    }
  ]
};
Copy

Type rows will take content as an array. These are all the options for each object inside the array.

typestring

If left blank, defaults to ‘text’. Controls how content field is rendered. Options are ‘text’, ‘json’, ‘image’. Note that you cannot have rows inside rows. Inception isn’t possible currently.

contentstring/json

Mixed content type, can be a string or JSON depending on what type is set.

labelstring

If set, shows a small label above the content.

const e = {
  name: "some event",
  avatar: "🤖",
  type : "rows",
  content : [
    {
      content : 'Text content, type is assumed to be text by default'
    },
    {
      label : 'label',
      type : 'text',
      content : 'Text content with label'
    },
    {
      type : 'image',
      label : 'image',
      content : `https://images.unsplash.com/photo-1724026403614-f5461d17c6cc?q=80&w=3200&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D`
    }
  ]
};
Copy

This will render the following event:

Here’s a much better example of a real life scenario.

const e = {
  name: "some event",
  avatar: "🤖",
  type : "rows",
  content : [
    {
      label : 'Name',
      content : 'Shash'
    },
    {
      label : 'Email',
      content : 'shash@operational.co'
    },
    {
      label : 'IP',
      content : '173.69.420.422'
    },
    {
      label : 'form',
      type : 'json',
      content : {
        works_in : 'performance marketing',
        found_us : 'google'
      }
    }
  ]
};
Copy
Event parametersActions

Operational

Event tracker for your product.

PrivacyTerms
About the product
  • Playground
  • API
  • Pitch
  • Wordpress plugin
  • Bubble plugin
Related to the product
  • VS Logsnag
  • Open Source
  • Articles
Useful articles for your business
  • Force post: The Payment Hack that lets Merchants charge you without approval
  • 6 Best practices for early stage B2B SaaS customer support
  • Setup event notifications for your SaaS
  • How to get high quality users for your B2B SaaS business?