Welcome to the Simon Data HTTP API. You can use this API to send event data to Simon Data from your event stream using HTTP.

Events API environments

There are three different API endpoints you can send events to, one for each of the typical environments that a company has:

Use these different endpoint to integrate with Simon for the different environments you deploy to.

Every request sent to the endpoint must be a POST request with the payload being JSON.

All request payloads sent to Simon's Events API will have the following:

ParameterRequiredDescription
partnerIdYesThe internal partnerId Simon uses to identify the customer's site.
contextYesA dictionary containing optional fields about the context of the event.
clientIdYesA unique identifier for the device. If no unique identifier for the device can be maintained this may be a unique identifier for the current session (max length: 45 characters).
partnerSecretYesThe shared secret used for authentication.
ipAddressNoThe public IP address of the users device if available.
sentAtYesEpoch time in milliseconds of when the request was sent. Epoch time is the number of milliseconds that have elapsed since January 1, 1970 (midnight UTC/GMT).
timezoneNoThe time difference between UTC time and local time, in minutes. See https://www.w3schools.com/jsref/jsref_gettimezoneoffset.asp for an example.
typeYesThe high level type of request being sent in can be either track or identify.

If you do not know your partner ID, please contact us.

The optional context attributes:

ParameterDescription
debugA setting for development, when if True, will tell the HTTP API to send validation errors as HTTP 412 errors. Boolean field, defaults to False.
nameUnique name for your client library. For example, our Simon JavaScript SDK sets this to simon.js.
versionVersion identifier for your client library.
userAgentThe user agent of the device sending the event, if available.
pageA dictionary representing parameters relevant to the page's context.
page.urlThe page url of the event which the event was triggered from, if available.
deviceA dictionary representing parameters relevant to the device's context.
device.typeString identifying the type of client device (e.g. android).

Sending clickstream data to Simon Data

🚧

Exceptions and debug mode

If you're unsure about whether your event is correctly formatted, you can use the debug mode. Exceptions will be silent unless the debug mode is active. Check out the details below.

The identify command

This is an example of an identify call:

{
    "partnerId": "804f98b48491143c2e4f2ffea854eb372a41bbfd",
    "clientId": "92adbc3c-c22b-49bf-a9ae-11d9e8b3e6b4",
    "context": {
        "version": "1.0.0",
        "name": "simon.js",
        "debug": true,
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36",
        "page": {
            "url": "http://localhost:9000/index.html"
        }
    },
    "partnerSecret": "1294b7e58f37568396b31ce481cf8edc1e6cfcb5",
    "sentAt": 1524776691259,
    "ipAddress": "127.0.0.1",
    "timezone": 240,
    "type": "identify",
    "userId": "97980cfea0067",
    "traits": {
        "name": "test",
        "email": "[email protected]",
        "firstName": "Joe",
        "lastName": "Smith",
        "userId": "97980cfea0067",
        "username": "joesmith",
        "properties": {
            "campaignId": "12345"
        }
    }
}

A call to identify establishes the identity associated with a userId. The variable userId is a user identifier that you specify. identify can be called to pass information when a source of identity is recognized, such as an authenticated login, an click from an email with an identity URL parameter, and signup for newsletter subscription. Different types of identifiers can be passed on.

Calling identify does not automatically establish identity for all subsequent track events. Include traits within the track calls to accomplish this.

When a user registers with you for the first time, you should call identify and also make a separate call to registration.

Valid values for the traits dictionary are as follows.

ValueTypeRequiredDescription
emailStringYesThe email address of the user (e.g. [email protected]).
firstNameStringNoThe first name of the user (e.g. Joe).
lastNameStringNoThe last name of the user (e.g. Smith).
nameStringNoThe full name of the user. (e.g. Joe Smith).
userIdStringNoThe user id. (e.g. 97980cfea0067).
userNameStringNoThe username (e.g. joesmith).
ARNStringNoThe ARN of the user. Used to sync Simon with Amazon SNS.
propertiesObjectNoAn object of extra arguments (e.g. { campaignId: '12345' }).

A note about identify and AWS SNS. The following fields should be set in your identify call for Simon to properly keep track of SNS identities:

  • userId: Set this to the internal user id for the user
  • context.device.type: Set this to the device type of the device to be synced with SNS. The value can be ios,android,kindle, or windows
  • traits.ARN: Set this to the AWS SNS ARN of the user's device

The track command

A track command may be invoked to pass user-interaction data to Simon Data. These user-interactions are captured by specific events that are documented in this API and are explained in more detail below. Each event has an Event Type specifying the name of the event and an associated Event Object which contains additional metadata about the event.

An example track command for a page_view event:

{
    "partnerId": "804f98b48491143c2e4f2ffea854eb372a41bbfd",
    "clientId": "92adbc3c-c22b-49bf-a9ae-11d9e8b3e6b4",
    "context": {
        "version": "1.0.0",
        "name": "simon.js",
        "debug": true,
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36",
        "page": {
            "url": "http://localhost:9000/index.html"
        }
    },
    "partnerSecret": "1294b7e58f37568396b31ce481cf8edc1e6cfcb5",
    "sentAt": 1524776691259,
    "ipAddress": "timezone": 240,
    "type": "track",
    "properties": {
        "title": "SimonJS Test Page",
        "language": "en-US"
    },
    "event": "page_view"
}

Note that this looks much like the identify call above with the exceptions that the type is track, instead of traits we have properties, and we have an extra parameter called event.

📘

Establishing identity within a 'track' call

Use traits containing userId and email parameters in the payload as a method to establish the identity associated with the track event, as in the below example.

{
    "partnerId": "804f98b48491143c2e4f2ffea854eb372a41bbfd",
    "clientId": "92adbc3c-c22b-49bf-a9ae-11d9e8b3e6b4",
    "context": {
        "version": "1.0.0",
        "name": "simon.js",
        "debug": true,
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36",
        "page": {
            "url": "http://localhost:9000/index.html"
        }
    },
    "partnerSecret": "1294b7e58f37568396b31ce481cf8edc1e6cfcb5",
    "sentAt": 1524776691259,
    "ipAddress": "127.0.0.1",
    "timezone": 240,
    "type": "track",
    "properties": {
        "title": "SimonJS Test Page",
        "language": "en-US"
    },
    "event": "page_view",
    "userId": "97980cfea0067",
    "traits": {
        "name": "test",
        "email": "[email protected]",
        "firstName": "Joe",
        "lastName": "Smith",
        "userId": "97980cfea0067",
        "username": "joesmith",
        "properties": {
            "campaignId": "12345"
        }
    }
}

Parameters

The properties that can be specified within the properties object literal vary depending on the event type.

🚧

Using custom properties

The event schema is enforced and events that are missing required properties or include unrecognized properties will be rejected during processing. Using the debug mode during your integration set-up will let you know that this is happening. However, all event types support custom properties within the properties.properties part of the payload (see an example for product view events). The API also supports custom events if there is not a pre-existing matching event type, but make sure to adhere to the schema for those events, too.

Event typeEvent object
page_viewnone
product_viewproductId
variant
quantity
productImageUrl
productUrl
brand
category
color
productName
size
style
price
properties
cartItems
add_to_cartproductId
variant
quantity
productImageUrl
productUrl
brand
category
color
productName
size
style
price
properties
cartItems
cartcartItems
productId
variant
quantity
productImageUrl
productUrl
brand
category
color
productName
size
style
price
properties
update_cartproductId
variant
quantity
productImageUrl
productUrl
brand
category
color
productName
size
style
previousQuantity
price
properties
cartItems
remove_from_cartproductId
variant
quantity
productImageUrl
productUrl
brand
category
color
productName
size
style
price
properties
cartItems
complete_transactiontransactionId
revenue
cartItems
productId
variant
quantity
productImageUrl
productUrl
brand
category
color
productName
size
style
price
properties
shipping
tax
promotion
properties
registrationemail
username
userId
optIn
firstName
lastName
properties
favoriteproductId
variant
productImageUrl
productUrl
brand
category
color
productName
size
style
price
properties
waitlistproductId
variant
quantity
productImageUrl
productUrl
brand
category
color
productName
size
style
price
properties
authenticationuserId
isLoggedIn
ARN
email
properties
customeventName
requiresIdentity
properties

Event types

The event field accepts the event types delineated below. A properties object literal must also be passed to the track command if the event has any required properties.

Page View

This is an example of a Page View event:

{
    "partnerId": "804f98b48491143c2e4f2ffea854eb372a41bbfd",
    "clientId": "92adbc3c-c22b-49bf-a9ae-11d9e8b3e6b4",
    "context": {
        "version": "1.0.0",
        "name": "simon.js",
        "debug": true,
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36",
        "page": {
            "url": "http://localhost:9000/index.html"
        }
    },
    "partnerSecret": "1294b7e58f37568396b31ce481cf8edc1e6cfcb5",
    "sentAt": 1524776691259,
    "ipAddress": "127.0.0.1",
    "timezone": 240,
    "type": "track",
    "properties": {
        "title": "SimonJS Test Page",
        "language": "en-US",
        "referrer": "http://www.google.com"
    },
    "traits": {
        "userId": "97980cfea0067",
        "email": "[email protected]"
    },
    "event": "page_view"
}

Page impressions are measured using the track command with the page_view event type. Details about the product are added in properties.

ValueTypeRequiredDescription
titleStringNoThe title of the page.
languageStringNoThe user language preference. This can change on an event by event basis, hence why it is not in the context parameter.
referrerStringNoThe URL of the referring page.

Product View

This is an example of a Product View event:

{
    "partnerId": "804f98b48491143c2e4f2ffea854eb372a41bbfd",
    "clientId": "92adbc3c-c22b-49bf-a9ae-11d9e8b3e6b4",
    "context": {
        "version": "1.0.0",
        "name": "simon.js",
        "debug": true,
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36",
        "page": {
            "url": "http://localhost:9000/index.html"
        }
    },
    "partnerSecret": "1294b7e58f37568396b31ce481cf8edc1e6cfcb5",
    "sentAt": 1524776691259,
    "ipAddress": "127.0.0.1",
    "timezone": 240,
    "type": "track",
    "properties": {
        "productId": "632910392",
        "variant": "808950810",
        "productImageUrl": "https://cdn.simondata.com/files/808950810.jpg",
        "productUrl": "https://www.simondata.com/apparel/t-shirts/808950810",
        "brand": "Acme",
        "category": "Apparel/Men/T-Shirts",
        "color": "Black",
        "productName": "Nyan Cat T-Shirt",
        "size": "Medium",
        "style": "Slim Cut",
        "price": 24.95,
        "properties": {
            "desc": "Slim cut t-shirt with a cat on it"
        }
    },
    "traits": {
        "userId": "97980cfea0067",
        "email": "[email protected]"
    },
    "event": "product_view"
}

Product impressions are measured using the track command with the product_view event type. Details about the product are added in properties.

ValueTypeRequiredDescription
productIdStringYesThe product ID or SKU (e.g. 632910392).
variantStringNoThe variant of the product (e.g. 808950810).
productImageUrlStringNoThe encoded URL for an image of the product (starts with http or https).
productUrlStringNoThe encoded URL for the product page (starts with http or https).
brandStringNoThe brand to which the product belongs (e.g. Acme).
categoryStringNoThe category to which the product belongs (e.g. Apparel). Use / as a delimiter to specify up to 5-levels of hierarchy (e.g. Apparel/Men/T-Shirts).
colorStringNoThe color of the product (e.g. Black).
productNameStringNoThe name of the product (e.g. Nyan Cat T-Shirt).
sizeStringNoThe size of the product (e.g. Medium).
styleStringNoThe style of the product (e.g. Slim Cut).
priceNumberNoThe price of a product (e.g. 24.95).
propertiesObjectNoAn object of extra arguments (e.g. { desc: 'Slim cut t-shirt with a cat on it' }).

Add To Cart

This is an example of an Add To Cart event:

{
    "partnerId": "804f98b48491143c2e4f2ffea854eb372a41bbfd",
    "clientId": "92adbc3c-c22b-49bf-a9ae-11d9e8b3e6b4",
    "context": {
        "version": "1.0.0",
        "name": "simon.js",
        "debug": true,
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36",
        "page": {
            "url": "http://localhost:9000/index.html"
        }
    },
    "partnerSecret": "1294b7e58f37568396b31ce481cf8edc1e6cfcb5",
    "sentAt": 1524776691259,
    "ipAddress": "127.0.0.1",
    "timezone": 240,
    "type": "track",
    "properties": {
        "productId": "632910392",
        "variant": "808950810",
        "quantity": 1,
        "productImageUrl": "https://cdn.simondata.com/files/808950810.jpg",
        "productUrl": "https://www.simondata.com/apparel/t-shirts/808950810",
        "brand": "Acme",
        "category": "Apparel/Men/T-Shirts",
        "color": "Black",
        "productName": "Nyan Cat T-Shirt",
        "size": "Medium",
        "style": "Slim Cut",
        "price": 24.95,
        "properties": {
            "desc": "Slim cut t-shirt with a cat on it"
        },
        "cartItems": [
            {
                "productId": "632910392",
                "variant": "808950810",
                "quantity": 1,
                "productImageUrl": "https://cdn.simondata.com/files/808950810.jpg",
                "productUrl": "https://www.simondata.com/apparel/t-shirts/808950810",
                "brand": "Acme",
                "category": "Apparel/Men/T-Shirts",
                "color": "Black",
                "productName": "Nyan Cat T-Shirt",
                "size": "Medium",
                "style": "Slim Cut",
                "price": 24.95,
                "properties": {
                    "desc": "Slim cut t-shirt with a cat on it"
                }
            }
        ]
    },
    "traits": {
        "userId": "97980cfea0067",
        "email": "[email protected]"
    },
    "event": "add_to_cart"
}

Products added to cart are captured using the track command with the add_to_cart event type. Details about the product are added in properties.

The call to add_to_cartsupports an optional cartItems array with all the items in the cart and their corresponding parameters (productId, variant etc.). cartItems should include the product that was just added.

ValueTypeRequiredDescription
productIdStringYesThe product ID or SKU (e.g. 632910392).
variantStringYesThe variant of the product (e.g. 808950810).
quantityNumberYesThe number of units added to the cart (e.g. 1).
productImageUrlStringNoThe encoded URL for an image of the product (starts with http or https).
productUrlStringNoThe encoded URL for the product page (starts with http or https).
brandStringNoThe brand to which the product belongs (e.g. Acme).
categoryStringNoThe category to which the product belongs (e.g. Apparel). Use / as a delimiter to specify up to 5-levels of hierarchy (e.g. Apparel/Men/T-Shirts).
colorStringNoThe color of the product (e.g. Black).
productNameStringNoThe name of the product (e.g. Nyan Cat T-Shirt).
sizeStringNoThe size of the product (e.g. Medium).
styleStringNoThe style of the product (e.g. Slim Cut).
priceNumberNoThe price of a product (e.g. 24.95).
propertiesObjectNoAn object of extra arguments (e.g. { desc: 'Slim cut t-shirt with a cat on it' }).
cartItemsArrayNoAn array with the full contents of the cart (e.g. [{item 1 parameters},{item 2 parameters},...]).

Cart

This is an example of a Cart event:

{
    "partnerId": "804f98b48491143c2e4f2ffea854eb372a41bbfd",
    "clientId": "92adbc3c-c22b-49bf-a9ae-11d9e8b3e6b4",
    "context": {
        "version": "1.0.0",
        "name": "simon.js",
        "debug": true,
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36",
        "page": {
            "url": "http://localhost:9000/index.html"
        }
    },
    "partnerSecret": "1294b7e58f37568396b31ce481cf8edc1e6cfcb5",
    "sentAt": 1524776691259,
    "ipAddress": "127.0.0.1",
    "timezone": 240,
    "type": "track",
    "properties": {
        "cartItems": [
            {
                "productId": "632910392",
                "variant": "808950810",
                "quantity": 1,
                "productImageUrl": "https://cdn.simondata.com/files/808950810.jpg",
                "productUrl": "https://www.simondata.com/apparel/t-shirts/808950810",
                "brand": "Acme",
                "category": "Apparel/Men/T-Shirts",
                "color": "Black",
                "productName": "Nyan Cat T-Shirt",
                "size": "Medium",
                "style": "Slim Cut",
                "price": 24.95,
                "properties": {
                    "desc": "Slim cut t-shirt with a cat on it"
                }
            }
        ]
    },
    "traits": {
        "userId": "97980cfea0067",
        "email": "[email protected]"
    },
    "event": "cart"
}

The complete contents of a cart can be sent using the track command with the cart event type. Details about the product are added in a cartItems array.

The following table describes the composition of an element in the cartItems array, which contains the full cart contents:

ValueTypeRequiredDescription
cartItemsArrayYesAn array with the full contents of the cart (e.g. [{item 1 parameters},{item 2 parameters},...]).
productIdStringYesThe product ID or SKU (e.g. 632910392).
variantStringYesThe variant of the product (e.g. 808950810).
quantityNumberYesThe quantity of the product added to the cart (e.g. 1).
productImageUrlStringNoThe encoded URL for an image of the product (starts with http or https).
productUrlStringNoThe encoded URL for the product page (starts with http or https).
brandStringNoThe brand to which the product belongs (e.g. Acme).
categoryStringNoThe category to which the product belongs (e.g. Apparel). Use / as a delimiter to specify up to 5-levels of hierarchy (e.g. Apparel/Men/T-Shirts).
colorStringNoThe color of the product (e.g. Black).
productNameStringNoThe name of the product (e.g. Nyan Cat T-Shirt).
sizeStringNoThe size of the product (e.g. Medium).
styleStringNoThe style of the product (e.g. Slim Cut).
priceNumberNoThe price of a product (e.g. 24.95).
propertiesObjectNoAn object of extra arguments (e.g. { desc: 'Slim cut t-shirt with a cat on it' }).

Update Cart

This is an example of an Update Cart event:

{
    "partnerId": "804f98b48491143c2e4f2ffea854eb372a41bbfd",
    "clientId": "92adbc3c-c22b-49bf-a9ae-11d9e8b3e6b4",
    "context": {
        "version": "1.0.0",
        "name": "simon.js",
        "debug": true,
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36",
        "page": {
            "url": "http://localhost:9000/index.html"
        }
    },
    "partnerSecret": "1294b7e58f37568396b31ce481cf8edc1e6cfcb5",
    "sentAt": 1524776691259,
    "ipAddress": "127.0.0.1",
    "timezone": 240,
    "type": "track",
    "properties": {
        "productId": "632910392",
        "variant": "808950810",
        "quantity": 2,
        "previousQuantity": 1,
        "productImageUrl": "https://cdn.simondata.com/files/808950810.jpg",
        "productUrl": "https://www.simondata.com/apparel/t-shirts/808950810",
        "brand": "Acme",
        "category": "Apparel/Men/T-Shirts",
        "color": "Black",
        "productName": "Nyan Cat T-Shirt",
        "size": "Medium",
        "style": "Slim Cut",
        "price": 24.95,
        "properties": {
            "desc": "Slim cut t-shirt with a cat on it"
        },
        "cartItems": [
            {
                "productId": "632910392",
                "variant": "808950810",
                "quantity": 2,
                "productImageUrl": "https://cdn.simondata.com/files/808950810.jpg",
                "productUrl": "https://www.simondata.com/apparel/t-shirts/808950810",
                "brand": "Acme",
                "category": "Apparel/Men/T-Shirts",
                "color": "Black",
                "productName": "Nyan Cat T-Shirt",
                "size": "Medium",
                "style": "Slim Cut",
                "price": 24.95,
                "properties": {
                    "desc": "Slim cut t-shirt with a cat on it"
                }
            }
        ]
    },
    "traits": {
        "userId": "97980cfea0067",
        "email": "[email protected]"
    },
    "event": "update_cart"
}

Update cart actions are measured using the track command with the update_cart event type. Details about the product are added in properties. Like the add_to_cart event, update_cart supports an optional cartItems array with the full cart contents including the most recent update.

ValueTypeRequiredDescription
productIdStringYesThe product ID or SKU (e.g. 632910392).
variantStringYesThe variant of the product (e.g. 808950810).
quantityNumberYesThe new quantity of the product in the cart (e.g. 2).
productImageUrlStringNoThe encoded URL for an image of the product (starts with http or https).
productUrlStringNoThe encoded URL for the product page (starts with http or https).
brandStringNoThe brand to which the product belongs (e.g. Acme).
categoryStringNoThe category to which the product belongs (e.g. Apparel). Use / as a delimiter to specify up to 5-levels of hierarchy (e.g. Apparel/Men/T-Shirts).
colorStringNoThe color of the product (e.g. Black).
productNameStringNoThe name of the product (e.g. Nyan Cat T-Shirt).
sizeStringNoThe size of the product (e.g. Medium).
styleStringNoThe style of the product (e.g. Slim Cut).
priceNumberNoThe price of a product (e.g. 24.95).
previousQuantityNumberNoThe previous quantity of the product in the cart (e.g. 1).
propertiesObjectNoAn object of extra arguments (e.g. { desc: 'Slim cut t-shirt with a cat on it' }).
cartItemsArrayNoAn array with the full contents of the cart (e.g. [{item 1 properties},{item 2 properties},...]).

Remove from Cart

This is an example of an Remove From Cart event:

{
    "partnerId": "804f98b48491143c2e4f2ffea854eb372a41bbfd",
    "clientId": "92adbc3c-c22b-49bf-a9ae-11d9e8b3e6b4",
    "context": {
        "version": "1.0.0",
        "name": "simon.js",
        "debug": true,
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36",
        "page": {
            "url": "http://localhost:9000/index.html"
        }
    },
    "partnerSecret": "1294b7e58f37568396b31ce481cf8edc1e6cfcb5",
    "sentAt": 1524776691259,
    "ipAddress": "127.0.0.1",
    "timezone": 240,
    "type": "track",
    "properties": {
        "productId": "632910392",
        "variant": "808950810",
        "quantity": 2,
        "productImageUrl": "https://cdn.simondata.com/files/808950810.jpg",
        "productUrl": "https://www.simondata.com/apparel/t-shirts/808950810",
        "brand": "Acme",
        "category": "Apparel/Men/T-Shirts",
        "color": "Black",
        "productName": "Nyan Cat T-Shirt",
        "size": "Medium",
        "style": "Slim Cut",
        "price": 24.95,
        "properties": {
            "desc": "Slim cut t-shirt with a cat on it"
        }
    },
    "traits": {
        "userId": "97980cfea0067",
        "email": "[email protected]"
    },
    "event": "remove_from_cart"
}

Remove from cart actions are measured using the track command with the remove_from_cart event type. Details about the product are added in properties. Like the add_to_cart event, remove_from_cart supports an optional cartItems array to send the full cart contents after the removed item.

ValueTypeRequiredDescription
productIdStringYesThe product ID or SKU (e.g. 632910392).
variantStringYesThe variant of the product (e.g. 808950810).
quantityNumberYesThe quantity of items that are removed for that product in the cart (e.g. 2).
productImageUrlStringNoThe encoded URL for an image of the product (starts with http or https).
productUrlStringNoThe encoded URL for the product page (starts with http or https).
brandStringNoThe brand to which the product belongs (e.g. Acme).
categoryStringNoThe category to which the product belongs (e.g. Apparel). Use / as a delimiter to specify up to 5-levels of hierarchy (e.g. Apparel/Men/T-Shirts).
colorStringNoThe color of the product (e.g. Black).
productNameStringNoThe name of the product (e.g. Nyan Cat T-Shirt).
sizeStringNoThe size of the product (e.g. Medium).
styleStringNoThe style of the product (e.g. Slim Cut).
priceNumberNoThe price of a product (e.g. 24.95).
propertiesObjectNoAn object of extra arguments (e.g. { desc: 'Slim cut t-shirt with a cat on it' }).
cartItemsArrayNoAn array with the full contents of the cart (e.g. [{item 1 properties},{item 2 properties},...]).

Complete Transaction

This is an example of a Complete Transaction event:

{
    "partnerId": "804f98b48491143c2e4f2ffea854eb372a41bbfd",
    "clientId": "92adbc3c-c22b-49bf-a9ae-11d9e8b3e6b4",
    "context": {
        "version": "1.0.0",
        "name": "simon.js",
        "debug": true,
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36",
        "page": {
            "url": "http://localhost:9000/index.html"
        }
    },
    "partnerSecret": "1294b7e58f37568396b31ce481cf8edc1e6cfcb5",
    "sentAt": 1524776691259,
    "ipAddress": "127.0.0.1",
    "timezone": 240,
    "type": "track",
    "properties": {
        "transactionId": "122710332",
        "revenue": 49.90,
        "shipping": 5.00,
        "tax": 2.29,
        "promotion": "PROMO_1234",
        "properties": {
            "campaignId": "12345"
        },
        "cartItems": [
            {
                "productId": "632910392",
                "variant": "808950810",
                "quantity": 1,
                "productImageUrl": "https://cdn.simondata.com/files/808950810.jpg",
                "productUrl": "https://www.simondata.com/apparel/t-shirts/808950810",
                "brand": "Acme",
                "category": "Apparel/Men/T-Shirts",
                "color": "Black",
                "productName": "Nyan Cat T-Shirt",
                "size": "Medium",
                "style": "Slim Cut",
                "price": 24.95,
                "properties": {
                    "desc": "Slim cut t-shirt with a cat on it"
                }
            },
            {
                "productId": "331910392",
                "variant": "408950811",
                "quantity": 1,
                "productImageUrl": "https://cdn.simondata.com/files/408950811.jpg",
                "productUrl": "https://www.simondata.com/apparel/t-shirts/408950811",
                "brand": "Acme",
                "category": "Apparel/Men/T-Shirts",
                "color": "White",
                "productName": "Inner Space T-Shirt",
                "size": "Medium",
                "style": "Slim Cut",
                "price": 24.95,
                "properties": {
                    "desc": "Slim cut t-shirt with planets on it"
                }
            }
        ]
    },
    "traits": {
        "userId": "97980cfea0067",
        "email": "[email protected]"
    },
    "event": "complete_transaction"
}

Successful transactions are measured using the track command with the complete_transaction event type. Details about the product are added in properties.

ValueTypeRequiredDescription
transactionIdStringYesThe transaction ID (e.g. 122710332).
revenueNumberYesSpecifies the revenue associated with the transaction (e.g. 49.90). It does not include shipping or tax costs.
cartItemsArrayYesAn array containing data about the products in the transaction (See table below).
shippingNumberNoSpecifies the total shipping cost of the transaction. (e.g. 5.00).
taxNumberNoSpecifies the total tax of the transaction. (e.g. 2.29).
promotionStringNoThe promotion ID (e.g. PROMO_1234).
propertiesObjectNoAn object of extra arguments (e.g. { campaignId: '12345' }).

The following table describes the composition of an element in the cartItems array:

ValueTypeRequiredDescription
productIdStringYesThe product ID or SKU (e.g. 632910392).
variantStringYesThe variant of the product (e.g. 808950810).
quantityNumberYesThe quantity of the product added to the cart (e.g. 1).
productImageUrlStringNoThe encoded URL for an image of the product (starts with http or https).
productUrlStringNoThe encoded URL for the product page (starts with http or https).
brandStringNoThe brand to which the product belongs (e.g. Acme).
categoryStringNoThe category to which the product belongs (e.g. Apparel). Use / as a delimiter to specify up to 5-levels of hierarchy (e.g. Apparel/Men/T-Shirts).
colorStringNoThe color of the product (e.g. Black).
productNameStringNoThe name of the product (e.g. Nyan Cat T-Shirt).
sizeStringNoThe size of the product (e.g. Medium).
styleStringNoThe style of the product (e.g. Slim Cut).
priceNumberNoThe price of a product (e.g. 24.95).
propertiesObjectNoAn object of extra arguments (e.g. { desc: 'Slim cut t-shirt with a cat on it' }).

Registration

This is an example of a Registration event:

{
    "partnerId": "804f98b48491143c2e4f2ffea854eb372a41bbfd",
    "clientId": "92adbc3c-c22b-49bf-a9ae-11d9e8b3e6b4",
    "context": {
        "version": "1.0.0",
        "name": "simon.js",
        "debug": true,
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36",
        "page": {
            "url": "http://localhost:9000/index.html"
        }
    },
    "partnerSecret": "1294b7e58f37568396b31ce481cf8edc1e6cfcb5",
    "sentAt": 1524776691259,
    "ipAddress": "127.0.0.1",
    "timezone": 240,
    "type": "track",
    "properties": {
        "email": "[email protected]",
        "username": "joesmith",
        "userId": "97980cfea0067",
        "optIn": true,
        "firstName": "Joe",
        "lastName": "Smith",
        "name": "Joe Smith",
        "properties": {
            "campaignId": "12345"
        }
    },
    "traits": {
        "userId": "97980cfea0067",
        "email": "[email protected]"
    },
    "event": "registration"
}

Track when users first register or sign up using the track command with the registration event type. Details about the registration are added in properties.

When a user registers with you for the firs time, you should call identify and separately also call registration.

ValueTypeRequiredDescription
emailStringYesThe email address of the user (e.g. [email protected]).
usernameStringNoThe username (e.g. joesmith).
userIdStringNoThe user id. (e.g. 97980cfea0067).
optInBooleanNoA boolean flag indicating whether this contact has opted in to receive marketing email.
firstNameStringNoThe first name of the user (e.g. Joe).
lastNameStringNoThe last name of the user (e.g. Smith).
nameStringNoThe full name of the user. (e.g. Joe Smith).
propertiesObjectNoAn object of extra arguments (e.g. { campaignId: '12345' }).

Favorite

This is an example of a Favorite event:

{
    "partnerId": "804f98b48491143c2e4f2ffea854eb372a41bbfd",
    "clientId": "92adbc3c-c22b-49bf-a9ae-11d9e8b3e6b4",
    "context": {
        "version": "1.0.0",
        "name": "simon.js",
        "debug": true,
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36",
        "page": {
            "url": "http://localhost:9000/index.html"
        }
    },
    "partnerSecret": "1294b7e58f37568396b31ce481cf8edc1e6cfcb5",
    "sentAt": 1524776691259,
    "ipAddress": "127.0.0.1",
    "timezone": 240,
    "type": "track",
    "properties": {
        "productId": "632910392",
        "variant": "808950810",
        "productImageUrl": "https://cdn.simondata.com/files/808950810.jpg",
        "productUrl": "https://www.simondata.com/apparel/t-shirts/808950810",
        "brand": "Acme",
        "category": "Apparel/Men/T-Shirts",
        "color": "Black",
        "productName": "Nyan Cat T-Shirt",
        "size": "Medium",
        "style": "Slim Cut",
        "price": 24.95,
        "properties": {
            "desc": "Slim cut t-shirt with a cat on it"
        }
    },
    "traits": {
        "userId": "97980cfea0067",
        "email": "[email protected]"
    },
    "event": "favorite"
}

Favorites are measured using the track command with the favorite event type. Details about the product are added in properties.

ValueTypeRequiredDescription
productIdStringYesThe product ID or SKU (e.g. 632910392).
variantStringNoThe variant of the product (e.g. 808950810).
productImageUrlStringNoThe encoded URL for an image of the product (starts with http or https).
productUrlStringNoThe encoded URL for the product page (starts with http or https).
brandStringNoThe brand to which the product belongs (e.g. Acme).
categoryStringNoThe category to which the product belongs (e.g. Apparel). Use / as a delimiter to specify up to 5-levels of hierarchy (e.g. Apparel/Men/T-Shirts).
colorStringNoThe color of the product (e.g. Black).
productNameStringNoThe name of the product (e.g. Nyan Cat T-Shirt).
sizeStringNoThe size of the product (e.g. Medium).
styleStringNoThe style of the product (e.g. Slim Cut).
priceNumberNoThe price of a product (e.g. 24.95).
propertiesObjectNoAn object of extra arguments (e.g. { desc: 'Slim cut t-shirt with a cat on it' }).

Waitlist

This is an example of an Waitlist event:

{
    "partnerId": "804f98b48491143c2e4f2ffea854eb372a41bbfd",
    "clientId": "92adbc3c-c22b-49bf-a9ae-11d9e8b3e6b4",
    "context": {
        "version": "1.0.0",
        "name": "simon.js",
        "debug": true,
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36",
        "page": {
            "url": "http://localhost:9000/index.html"
        }
    },
    "partnerSecret": "1294b7e58f37568396b31ce481cf8edc1e6cfcb5",
    "sentAt": 1524776691259,
    "ipAddress": "127.0.0.1",
    "timezone": 240,
    "type": "track",
    "properties": {
        "productId": "632910392",
        "variant": "808950810",
        "quantity": 1,
        "productImageUrl": "https://cdn.simondata.com/files/808950810.jpg",
        "productUrl": "https://www.simondata.com/apparel/t-shirts/808950810",
        "brand": "Acme",
        "category": "Apparel/Men/T-Shirts",
        "color": "Black",
        "productName": "Nyan Cat T-Shirt",
        "size": "Medium",
        "style": "Slim Cut",
        "price": 24.95,
        "properties": {
            "desc": "Slim cut t-shirt with a cat on it"
        }
    },
    "traits": {
        "userId": "97980cfea0067",
        "email": "[email protected]"
    },
    "event": "waitlist"
}

A waitlist event should be called when a contact chooses to be added to a waitlist for a product that is out of stock. This is a track event with the waitlist event type. Details about the product are added in properties.

ValueTypeRequiredDescription
productIdStringYesThe product ID or SKU (e.g. 632910392).
variantStringYesThe variant of the product (e.g. 808950810).
quantityNumberNoThe quantity of the product added to the waitlist (e.g. 1).
productImageUrlStringNoThe encoded URL for an image of the product (starts with http or https).
productUrlStringNoThe encoded URL for the product page (starts with http or https).
brandStringNoThe brand to which the product belongs (e.g. Acme).
categoryStringNoThe category to which the product belongs (e.g. Apparel). Use / as a delimiter to specify up to 5-levels of hierarchy (e.g. Apparel/Men/T-Shirts).
colorStringNoThe color of the product (e.g. Black).
productNameStringNoThe name of the product (e.g. Nyan Cat T-Shirt).
sizeStringNoThe size of the product (e.g. Medium).
styleStringNoThe style of the product (e.g. Slim Cut).
priceNumberNoThe price of a product (e.g. 24.95).
propertiesObjectNoAn object of extra arguments (e.g. { desc: 'Slim cut t-shirt with a cat on it' }).

Authentication

This is an example of an Authentication event:

{
    "partnerId": "804f98b48491143c2e4f2ffea854eb372a41bbfd",
    "clientId": "92adbc3c-c22b-49bf-a9ae-11d9e8b3e6b4",
    "context": {
        "version": "1.0.0",
        "name": "simon.js",
        "debug": true,
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36",
        "page": {
            "url": "http://localhost:9000/index.html"
        }
    },
    "partnerSecret": "1294b7e58f37568396b31ce481cf8edc1e6cfcb5",
    "sentAt": 1524776691259,
    "ipAddress": "127.0.0.1",
    "timezone": 240,
    "type": "track",
    "properties": {
        "userId": "xyz123456",
        "isLoggedIn": true,
        "ARN": "arn:aws:sns:us-east-1:123456789:example-arn-2",
        "email": "[email protected]",
        "properties": {
            "appVersion": "3.4.1"
        }
    },
    "traits": {
        "userId": "97980cfea0067",
        "email": "[email protected]"
    },
    "event": "authentication"
}

📘

When to use 'identify' vs 'authentication'

The general method to establish the identity for users is to use the identify call. The authentication event is mainly useful when using Amazon SNS as a channel for push messaging. It is used tie an ARN identifier with the userId. Always use identify except to specifically provide an ARN.

An authentication event should be called when a user logs in or out of the service. This is a track event with the authentication event type. Details about the product are added in properties.

ValueTypeRequiredDescription
userIdStringYesThe unique userId of the user authenticating.
isLoggedInBooleanYesA flag indicating if the user is logging into the system. This should be false when the user is logging out.
ARNStringYesThe Amazon AWS ARN the of the user.
emailStringNoThe email address of the user authenticating.
propertiesObjectnoAn object of extra arguments.

Custom

This is an example of a Custom event:

{
	"partnerId": "804f98b48491143c2e4f2ffea854eb372a41bbfd",
	"clientId": "92adbc3c-c22b-49bf-a9ae-11d9e8b3e6b4",
	"context": {
		"version": "1.0.0",
		"name": "simon.js",
		"debug": true,
		"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36",
		"page": {
			"url": "http://localhost:9000/index.html"
		}
	},
	"partnerSecret": "1294b7e58f37568396b31ce481cf8edc1e6cfcb5",
	"sentAt": 1524776691259,
	"ipAddress": "127.0.0.1",
	"timezone": 240,
	"type": "track",
	"properties": {
		"eventName": "event_abc",
		"requiresIdentity": true,
		"properties": {
			"desc": "Slim cut t-shirt with a cat on it"
		}
	},
	"traits": {
		"userId": "97980cfea0067",
		"email": "[email protected]"
	},
	"event": "custom"
}

custom type is used to track events that do not map to one of the pre-defined event types. This is a track event with the custom event type. Details are added in added in an eventObject.

ValueTypeRequiredDescription
eventNameStringYesThe custom event type name (max length: 38 characters).
propertiesObjectNoAn object of extra arguments.
requiresIdentityBoolNoIf False, the event will not require an email or match an identify event to be used. Defaults to True.

Debugging

Enabling debug mode

Debug mode can be enabled by setting the debug parameter to true when adding the tag.

Add the setting to the tag to enable debug mode:

context.debug: true

🚧

Exceptions are silent by default

By default, exceptions are caught silently and sent to our servers for further analysis. Enabling debug mode will send validation errors as HTTP 412 errors. The debug field defaults to False.

Understanding server responses

Add to cart event missing productId:

{
    "partnerId": "804f98b48491143c2e4f2ffea854eb372a41bbfd",
    "clientId": "92adbc3c-c22b-49bf-a9ae-11d9e8b3e6b4",
    "context": {
        "version": "1.0.0",
        "name": "simon.js",
        "debug": true,
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36",
        "page": {
            "url": "http://localhost:9000/index.html"
        }
    },
    "partnerSecret": "1294b7e58f37568396b31ce481cf8edc1e6cfcb5",
    "sentAt": 1524776691259,
    "ipAddress": "127.0.0.1",
    "timezone": 240,
    "type": "track",
    "properties": {
        "variant": "808950810",
        "quantity": 1,
        "productImageUrl": "https://cdn.simondata.com/files/808950810.jpg",
        "productUrl": "https://www.simondata.com/apparel/t-shirts/808950810",
        "brand": "Acme",
        "category": "Apparel/Men/T-Shirts",
        "color": "Black",
        "productName": "Nyan Cat T-Shirt",
        "size": "Medium",
        "style": "Slim Cut",
        "price": 24.95,
        "properties": {
            "desc": "Slim cut t-shirt with a cat on it"
        },
        "cartItems": [
            {
                "variant": "808950810",
                "quantity": 1,
                "productImageUrl": "https://cdn.simondata.com/files/808950810.jpg",
                "productUrl": "https://www.simondata.com/apparel/t-shirts/808950810",
                "brand": "Acme",
                "category": "Apparel/Men/T-Shirts",
                "color": "Black",
                "productName": "Nyan Cat T-Shirt",
                "size": "Medium",
                "style": "Slim Cut",
                "price": 24.95,
                "properties": {
                    "desc": "Slim cut t-shirt with a cat on it"
                }
            }
        ]
    },
    "traits": {
        "userId": "97980cfea0067",
        "email": "[email protected]"
    },
    "event": "add_to_cart"
}

If the implementation of your client code is healthy, all POST requests should complete with a 200 (OK) or 204 (No Content) response code. Our servers will respond with a 412 (Precondition Failed) response code in the case that a given request does not meet our criteria and debug mode is on. The example contains a properties object missing a required field and the corresponding response.

Error Response CodeAction
412You are sending invalid data. Check the response body for more specifics.
500Contact Simon Data.

Response from server:

{error: "Error validating event: add_to_cart; property not found: productId"}