Event Object

Prev Next

The Event object helps you create custom events and event parameters in different data types. This article explains how to build events and parameters across various data types.

Build event

This method allows you to build your Insider event object.

You need to call this method to trigger your event.

Method signature

build()

Method example

insiderExampleEvent.build();

Set tag event

This method returns a new chainable Insider event object in which you can add parameters. 

Your event name should be lowercase and not include special characters, non-Latin characters, or spaces. Otherwise, this event will be ignored. You can use underscores.
ParameterData Type
eventNameString

Method signature

tagEvent(eventName: string): Event;

Method example

// You can create an event without parameters and call the build method;
const event = window.Insider.tagEvent("event_name").build();
If you don't call Insider One's Build Event method at the end of the chaining, this method won't function.

Set string parameter

This method allows you to set the string parameter of your Insider event object. 

Your parameter key should be lowercase and should not include any special characters, non-Latin characters, or any spaces. Otherwise, this parameter will be ignored. You can use underscores.
ParameterData Type
keyString
valueString

The value can be up to 50,000 characters. For arrays, the limit applies to each string. An event with a longer value isn't recorded.

Method signature

addParameterWithString(key: string, value: string): Event;

Method example

// You can create an event with parameters and call the build method
const event = window.Insider.tagEvent("event_name").addParameterWithString('string_parameter','parameter').build();
If you do not call Insider's Build Event method at the end of the chaining, this method will not function.

Set integer parameter

This method allows you to set the integer parameter of your Insider event object. 

Your parameter key should be lowercase and should not include any special characters, non-Latin characters, or any spaces. Otherwise, this parameter will be ignored. You can use underscores.
ParameterData Type
keyString
valueNumber

Method signature

addParameterWithInt(key: string, value: number): Event;

Method example

// You can create an event with parameters and call the build method
const event = window.Insider.tagEvent("event_name").addParameterWithInt('int_parameter', 10).build();
If you do not call Insider's Build Event method at the end of the chaining, this method will not function.

Set double parameter

This method allows you to set the double parameter of your Insider event object. 

Your parameter key should be lowercase and should not include any special characters, non-Latin characters, or any spaces. Otherwise, this parameter will be ignored. You can use underscores.
ParameterData Type
keyString
valueDouble

Method signature

addParameterWithDouble(key: string, value: number): Event;

Method example

// You can create an event with parameters and call the build method
const event = window.Insider.tagEvent("event_name").addParameterWithDouble('double_parameter',10.5).build();
If you do not call Insider's Build Event method at the end of the chaining, this method will not function.

Set date parameter

This method allows you to set the date parameter of your Insider event object. 

Your parameter key should be lowercase and should not include any special characters, non-Latin characters, or any spaces. Otherwise, this parameter will be ignored. You can use underscores.
ParameterData Type
keyString
valueDate

Method signature

addParameterWithDate(key: string, value: Date()): Event;

Method example

// You can create an event with parameters and call the build method
const event = window.Insider.tagEvent("event_name").addParameterWithDate('date_parameter', new Date())
.build();
If you do not call Insider's Build Event method at the end of the chaining, this method will not function.

Set array of string parameter

This method allows you to set the array of string parameter of your Insider event object. 

Your parameter key should be lowercase and should not include any special characters, non-Latin characters, or any spaces. Otherwise, this parameter will be ignored. You can use underscores.
You can call this method only with an array of strings. Otherwise, this parameter will be ignored.
ParameterData Type
keyString
valueArray (of string)

The value can be up to 50,000 characters. For arrays, the limit applies to each string. An event with a longer value isn't recorded.

Method signature

addParameterWithStringArray(key: string, value: Array<string>): Event

Method example

const stringArray = ['value1', 'value2', 'value3'];
window.Insider.tagEvent('eventName')
         .addParameterWithStringArray('key', stringArray)
         .build();
If you do not call Insider's Build Event method at the end of the chaining, this method will not function.

Set array of number parameter

This method allows you to set the array of number parameters of your Insider event object. 

Your parameter key should be only numbers. Otherwise, this parameter will be ignored.
You can call this method only with an array of numbers. Otherwise, this parameter will be ignored.
ParameterData Type
keyNumber
valueArray (of number)

Method signature

addParameterWithNumericArray(key: string, value: Array<number>): Event

Method example

const numberArray = [5, 3.14, 100];
window.Insider.tagEvent('eventName')
         .addParameterWithNumericArray('key', numberArray)
         .build();
If you do not call Insider's Build Event method at the end of the chaining, this method will not function.

Set boolean parameter

This method allows you to set the boolean parameter of your Insider event object. 

Your parameter key should be lowercase and should not include any special characters, non-Latin characters, or any spaces. Otherwise, this parameter will be ignored. You can use underscores.
ParameterData Type
keyString
valueBoolean

Method signature

addParameterWithBoolean(key: string, value: boolean): Event;

Method example

// You can create an event with parameters and call the build method
const event = window.Insider.tagEvent("event_name").addParameterWithBoolean('boolean_parameter', true).build();
If you do not call Insider's Build Event method at the end of the chaining, this method will not function.