InsiderEvent

Prev Next

The InsiderEvent helps you create custom events and event parameters in different data types.

Name

Description

Type

Required

name

Event name

String

Yes

custom identifier

Use setter methods to change

Any

No

Set tagEvent

This method creates and optionally builds events with the given name.

Parameter

Type

Description

Required

name

String

Event name

Yes

Below are additional methods to attach attributes to an event:

Parameter

Type

Required

addStringParameter

String

Yes

addNumericParameter

Number

Yes

addBooleanParameter

Boolean

Yes

addDateParameter

Date

Yes

addStringArrayParameter

[String]

Yes

addNumericArrayParameter

[Number]

Yes

tagEvent(string name) : Promise<InsiderEvent>
const event = window.insider.tagEvent('custom_event');
                    event
                    .addStringParameter('custom_string', 'custom_string_value')
                    .addNumericParameter('custom_integer', 123)
                    .addNumericParameter('custom_double', 23.01)
                    .addBooleanParameter('custom_boolean', true)
                    .addDateParameter('custom_date', new Date())
                    .addStringArrayParameter('custom_string_array', ['str1', 'str2', 'str3'])
                    .addNumericArrayParameter('custom_numeric_array', [1, 2, 3, 4.4]);
                    await event.build();

Page visit events

You should trigger the page visit events when a user visits the respective page type in the application. The default page visit events include the Homepage View, Listing Page View, Product Detail Page View, Cart Page View, and Confirmation Page View. See below for their method signatures and examples.

visitHomePage

This method creates and builds a homepage event.

visitHomePage() : Promise<void>
await window.insider.visitHomePage();

visitListingPage

This method creates and builds a product listing page event.

Parameter

Type

Description

Required

taxonomy

[String]

Product categories

Yes

visitListingPage([string] taxonomy) : Promise<void>
const taxonomy = ["Male", "T-shirt", "Insider"];
                    await window.insider.visitListingPage(taxonomy);

visitProductDetailsPage

This method creates and builds a detailed page event for the given product.

Parameter

Type

Description

Required

product

InsiderProduct

Product object

Yes

visitProductDetailsPage(InsiderProduct product) : Promise<void>
const product = window.insider.createNewProduct(
                    'productId',
                    'productName',
                    ['male', 't-shirt'],
                    'https://localhost/1234/shirt_1.png',
                    123.45,
                    'USD'
                    )
                    await window.insider.visitProductDetailsPage(product);

visitCartPage

This method creates and builds a cart-page event with the given products.

Parameter

Type

Description

Required

products

[InsiderProduct]

Product objects

Yes

visitCartPage([InsiderProduct] products) : Promise<void>
const product = window.insider.createNewProduct(
                    'productId',
                    'productName',
                    ['male', 't-shirt'],
                    'https://localhost/1234/shirt_1.png',
                    123.45,
                    'USD'
                    )
                    await window.insider.visitCartPage([product]);

itemPurchased (Confirmation page view)

This method creates and builds an item purchase event with the given order ID and product.

Parameter

Type

Description

Required

orderID

String

Order identifier

Yes

product

InsiderProduct

Product object

Yes

itemPurchased(string orderID, InsiderProduct product) : Promise<void>
const product = window.insider.createNewProduct(
  'productId', 
  'productName', 
  ['male', 't-shirt'], 
  'https://localhost/1234/shirt_1.png', 
  123.45, 
  'USD'
)
await window.insider.itemPurchased('orderId-12345', product);

visitWishlist

This method creates and builds a wishlist event with the given products.

Parameter

Type

Description

Required

products

[InsiderProduct]

Product objects

Yes

visitWishlist([InsiderProduct] products) : Promise<void>
const product = window.insider.createNewProduct(
                    'productId',
                    'productName',
                    ['male', 't-shirt'],
                    'https://localhost/1234/shirt_1.png',
                    123.45,
                    'USD'
                    )
                    await window.insider.visitWishlist([product]);

Wishlist events

You should trigger the wishlist events when a user takes the action for the respective type of wishlist moves in the application. The default wishlist events include the Item Added to Wishlist, Item Removed from Wishlist, and Wishlist Cleared. See below for their method signatures and examples.

itemAddedToWishlist

This method creates and builds an item added to wishlist event with the given product.

Parameter

Type

Description

Required

product

InsiderProduct

Product object

Yes

itemAddedToWishlist(InsiderProduct product) : Promise<void>
const product = window.insider.createNewProduct(
                    'productId',
                    'productName',
                    ['male', 't-shirt'],
                    'https://localhost/1234/shirt_1.png',
                    123.45,
                    'USD'
                    )
                    await window.insider.itemAddedToWishlist(product);

itemRemovedFromWishlist

This method creates and builds an item removed from wishlist event with the given product id.

Parameter

Type

Description

Required

productID

String

Product identifier

Yes

itemRemovedFromWishlist(string productID) : Promise<void>
await window.insider.itemRemovedFromWishlist('productId');

wishlistCleared

This method creates and builds a clear wishlist event.

wishlistCleared() : Promise<void>
await window.insider.wishlistCleared();

Cart events

You should trigger the cart events when a user takes the action for the respective type of cart moves in the application. The default cart events include the Item Added to Cart, Item Removed from Cart, and Cart Cleared. See below for their method signatures and examples.

itemAddedToCart

This method creates and builds an item added to cart event with the given product.

Parameter

Type

Description

Required

product

InsiderProduct

Product object

Yes

itemAddedToCart(InsiderProduct product) : Promise<void>
const product = window.insider.createNewProduct(
                    'productId',
                    'productName',
                    ['male', 't-shirt'],
                    'https://localhost/1234/shirt_1.png',
                    123.45,
                    'USD'
                    )
                    await window.insider.itemAddedToCart(product);

itemRemovedFromCart

This method creates and builds an item removed from cart event with the given product id.

Parameter

Type

Description

Required

productID

String

Product identifier

Yes

itemRemovedFromCart(string productID) : Promise<void>
await window.insider.itemRemovedFromCart('productId');

cartCleared

This method creates and builds a clear cart event.

cartCleared() : Promise<void>
await window.insider.cartCleared();