shell

Introduction

curl "https://api.intempt.com"

Example response:

{
  "service": "crel",
  "version": "v1",
  "status": "ok",
  "_links": {
    "sources": {
      "href": "https://api.intempt.com/v1/your-org/sources/"
    }
  }
}

Intempt API allows developers to integrate Ecommerce platforms, CRMs and POS machines with Intempt real time segmentation platform.

Base URL: https://api.intempt.com/

Sending request to the root URL will return API details.

HTTP Request

GET https://api.intempt.com

Authentication

Intempt uses api keys to authorize API access. To get hold of an api key, you will first need to login to Intempt Console.

Login here.

Or create a new account here.

Navigate to the edit view of an existing Source or create a new one.

The api key will be located in the Source configuration object in the code box at the bottom.

Intempt expects the api key to be included in all API requests in a header that looks like the following:

Authorization: ApiKey <YOUR_API_KEY>

Sources

Intempt Source represents integration of Intempt with one of supported platforms (Shopify, HubSpot, Magento, POS system, etc.) or client's website/mobile app.

Get All Sources

curl "https://api.intempt.com/v1/your-org/sources"
  -H "Authorization: ApiKey <YOUR_API_KEY>"

Example response:

{
  "_embedded": {
    "sources": [
      {
        "id": 23525541210886144,
        "name": "tracker",
        "title": "Tracker",
        "description": "Automatically created tracker for organization's domain",
        "type": "js",
        "_links": {
          "self": {
            "href": "https://api.intempt.com/v1/your-org/sources/23525541210886144"
          },
          "collections": {
            "href": "https://api.intempt.com/v1/your-org/sources/23525541210886144/collections"
          }
        }
      }
    ]
  },
  "_links": {
    "self": {
      "href": "https://api.intempt.com/v1/your-org/sources"
    },
    "byName": {
      "href": "https://api.intempt.com/v1/your-org/sources{?name}",
      "templated": true
    }
  }
}

This endpoint retrieves all sources for selected organization.

HTTP Request

GET https://api.intempt.com/v1/your-org/sources

Success Response

This call will return an array of all Sources for specified organization.

Each Source object contains id, name, title, description, type properties, alongside with child _links object. Link to self points to the source itself , while collections points to the list of all collections for this Source.

Root _links object also has self link, as well as byName link to fetch a specific Source by its name property.

Get a Source

curl "https://api.intempt.com/v1/your-org/sources/source-id"
  -H "Authorization: ApiKey <YOUR_API_KEY>"

Example response:

{
    "id": 23525541210886144,
    "name": "tracker",
    "title": "Tracker",
    "description": "Automatically created tracker for organization's domain",
    "type": "js",
    "_links": {
        "self": {
            "https://api.intempt.com/v1/your-org/sources/23525541210886144"
        },
        "collections": {
            "https://api.intempt.com/v1/your-org/sources/23525541210886144/collections"
        }
    }
}

This endpoint retrieves a specific Source.

HTTP Request

GET https://api.intempt.com/v1/your-org/sources/<ID>

URL Parameters

Parameter Description
ID The ID of the Source to retrieve

Success Response

This call will return a Source object that contains id, name, title, description, type properties, alongside with _links object. Link to self points to the Source itself , while collections points to the list of all collections for this Source.

Delete a Source

curl "https://api.intempt.com/v1/your-org/sources/194123921"
  -X DELETE
  -H "Authorization: ApiKey <YOUR_API_KEY>"

Example response:

{
    "id": 23525541210886144,
    "name": "tracker",
    "title": "Tracker",
    "description": "Automatically created tracker for organization's domain",
    "type": "js",
    "_links": {
        "self": {
            "href": "https://api.intempt.com/v1/your-org/sources/23525541210886144"
        },
        "collections": {
            "href": "https://api.intempt.com/v1/your-org/sources/23525541210886144/collections"
        }
    }
}

This endpoint deletes a specific Source.

HTTP Request

DELETE https://api.intempt.com/v1/your-org/sources/<ID>

URL Parameters

Parameter Description
ID The ID of the Source to delete

Success Response

On successful delete, the deleted Source will be sent in the response.

Sources Data

Source data endpoint allows sending multiple data items to multiple collections in the same http request.

curl "https://api.intempt.com/v1/your-org/sources/source-id/data"
  -d 
  '{
    "page":[{
        "visitorId": "93b82f97-809e-40ac-4f98-33423c4d0de6",
        "eventId": "94f9af87-4798-421d-b045-2b23418cd31b",
        "serverTimestamp": 1583241373335,
        "timestamp": 1583241372975,
        "parentTimestamp": 1583241176530,
        "title": "Hamlet Pant â“ Intempt1",
        "pageUrl": {
            "scheme": "https",
            "userInfo": null,
            "host": "demo.intempt.com",
            "port": null,
            "path": "/collections/pants/products/hamlet-pant",
            "query": null,
            "fragment": null
        }
    }],
    "interaction":[{
        "visitorId": "93b82f97-809e-40ac-4f98-33423c4d0de6",
        "eventId": "a475ad7b-3a55-497f-891f-bffc08dc7417",
        "serverTimestamp": 1583241261990,
        "timestamp": 1583241261532,
        "parentTimestamp": 1583241197506,
        "type": "click",
        "element": {
            "tag": "a",
            "name": null,
            "href": "/collections/pants/products/hamlet-pant",
            "className": "grid-view-item__link grid-view-item__image-container",
            "classList": [],
            "id": "",
            "path": "div:nth-child(4) > main > div > div > div > div > div:nth-child(4) > div > a",
            "text": "Hamlet Pant\nRegular price\n$208.60",
            "value": null,
            "number": 208.6,
            "checked": null,
                "attributes": {}
            }
    },{
        "visitorId": "93b82f97-809e-40ac-4f98-33423c4d0de6",
        "eventId": "af9f579a-796d-4e49-b1f5-33be7db5423e",
        "serverTimestamp": 1583241179982,
        "timestamp": 1583241178977,
        "parentTimestamp": 1583241178647,
        "type": "click",
        "element": {
            "tag": "div",
            "name": null,
            "href": null,
            "className": "page-width",
            "classList": [],
            "id": "",
            "path": "div:nth-child(4) > main > div:nth-child(2) > div",
            "text": "COLLECTION LIST\nDress\nAccessories\nPants",
            "value": null,
            "number": null,
            "checked": null,
            "attributes": {}
        }
    }]
  }'
  -X POST
  -H "Authorization: ApiKey <YOUR_API_KEY>"

Example response:

{
    "_embedded": {
        "data": [
            {
                "collId": 63065212245184512,
                "id": 68117041425346560,
                "updated": 1583250384494,
                "data": {
                    "visitorId": "93b82f97-809e-40ac-4f98-33423c4d0de6",
                    "eventId": "94f9af87-4798-421d-b045-2b23418cd31b",
                    "serverTimestamp": 1583241373335,
                    "timestamp": 1583241372975,
                    "parentTimestamp": 1583241176530,
                    "title": "Hamlet Pant â“ Intempt1",
                    "pageUrl": {
                        "scheme": "https",
                        "userInfo": null,
                        "host": "demo.intempt.com",
                        "port": null,
                        "path": "/collections/pants/products/hamlet-pant",
                        "query": null,
                        "fragment": null
                    }
                },
                "_links": {
                    "collection": {
                        "href": "http://localhost:8081/v1/demo-intempt-com/collections/63065212245184512"
                    },
                    "self": {
                        "href": "http://localhost:8081/v1/demo-intempt-com/collections/63065212245184512/data/68117041425346560"
                    }
                }
            },
            {
                "collId": 63065212245184514,
                "id": 68116568966369280,
                "updated": 1583250384494,
                "data": {
                    "visitorId": "93b82f97-809e-40ac-4f98-33423c4d0de6",
                    "eventId": "a475ad7b-3a55-497f-891f-bffc08dc7417",
                    "serverTimestamp": 1583241261990,
                    "timestamp": 1583241261532,
                    "parentTimestamp": 1583241197506,
                    "type": "click",
                    "element": {
                        "tag": "a",
                        "name": null,
                        "href": "/collections/pants/products/hamlet-pant",
                        "className": "grid-view-item__link grid-view-item__image-container",
                        "classList": [],
                        "id": "",
                        "path": "div:nth-child(4) > main > div > div > div > div > div:nth-child(4) > div > a",
                        "text": "Hamlet Pant\nRegular price\n$208.60",
                        "value": null,
                        "number": 208.6,
                        "checked": null,
                        "attributes": {}
                    }
                },
                "_links": {
                    "collection": {
                        "href": "http://localhost:8081/v1/demo-intempt-com/collections/63065212245184514"
                    },
                    "self": {
                        "href": "http://localhost:8081/v1/demo-intempt-com/collections/63065212245184514/data/68116568966369280"
                    }
                }
            },
            {
                "collId": 63065212245184514,
                "id": 68116225201205248,
                "updated": 1583250384494,
                "data": {
                    "visitorId": "93b82f97-809e-40ac-4f98-33423c4d0de6",
                    "eventId": "af9f579a-796d-4e49-b1f5-33be7db5423e",
                    "serverTimestamp": 1583241179982,
                    "timestamp": 1583241178977,
                    "parentTimestamp": 1583241178647,
                    "type": "click",
                    "element": {
                        "tag": "div",
                        "name": null,
                        "href": null,
                        "className": "page-width",
                        "classList": [],
                        "id": "",
                        "path": "div:nth-child(4) > main > div:nth-child(2) > div",
                        "text": "COLLECTION LIST\nDress\nAccessories\nPants",
                        "value": null,
                        "number": null,
                        "checked": null,
                        "attributes": {}
                    }
                },
                "_links": {
                    "collection": {
                        "href": "http://localhost:8081/v1/demo-intempt-com/collections/63065212245184514"
                    },
                    "self": {
                        "href": "http://localhost:8081/v1/demo-intempt-com/collections/63065212245184514/data/68116225201205248"
                    }
                }
            }
        ]
    },
    "_links": {
        "self": {
            "href": "http://localhost:8081/v1/demo-intempt-com/sources/63065209300783104/data"
        }
    }
}

Propeties in request object are names of the collection to save data to, and values are lists of data items with properties corresponding to collection schema.

Collections

Collections describe schemas for events or data of a certain type, while collection data items represent cpecific pieces of data in that collection.

To put that in relational terms, collections are tables that describe columns (types,constraints, etc.), and collection data items are rows of values for those columns.

For example, collections can be created for:

After creating a collection, use collection data endpoints to store and retrieve actual data items.

Intempt platform collection schemas should comply to Apache Avro spec

Get All Collections

curl "https://api.intempt.com/v1/your-org/collections"
  -H "Authorization: ApiKey <YOUR_API_KEY>"

Example response:

{
  "_embedded": {
    "collections": [
      {
        "id": 19554189106348032,
        "sourceId": 347816547721216,
        "name": "booking",
        "profile": false,
        "event": false,
        "schema": {
          "type": "record",
          "name": "booking",
          "namespace": "customSource",
          "fields": [
            {
              "name": "id",
              "type": "long"
            },
            {
              "name": "bookingDate",
              "type": "long",
              "default": -1
            },
            {
              "name": "guestId",
              "type": "long"
            },
            {
              "name": "roomId",
              "type": "long"
            }
          ]
        },
        "_links": {
          "self": {
            "href": "https://api.intempt.com/v1/your-org/collections/19554189106348032"
          },
          "data": {
            "href": "https://api.intempt.com/v1/your-org/collections/19554189106348032/data"
          },
          "byName": {
            "href": "https://api.intempt.com/v1/your-org/collections?{name}",
            "templated": true
          }
        }
      }
    ]
  },
  "_links": {
    "self": {
      "href": "https://api.intempt.com/v1/your-org/collections{?name}",
      "templated": true
    }
  }
}

This endpoint retrieves all collections for selected organization.

HTTP Request

https://api.intempt.com/v1/your-org/collections

Success Response

This call will return an array of collection objects that contain id, sourceId, name, profile, event and schema properties, alongside with child _links object.

schema property defines the schema of this collection, all collection data items have to follow this schema.

sourceId property shows to which Source this collection belongs.

profile property shows whether collection is a user profile collection.

Profile collection primary id is used as a profile id across whole application. Profile collection requires also a user id, so we can link profile to a user. Only one profile collection is allowed per application.

event property shows whether collection is an event collection. Key difference of event type collection is that it has many-to-one relation with a profile.

Event collection is required to have profile id. Events not belonging to any profile are not supported.

In the _links object self points to the collection itself, data points to the data in this collection, byName points to a specific collection finding it by its name.

Get a Specific Collection

curl "https://api.intempt.com/v1/your-org/collections/collection-id"
  -H "Authorization: ApiKey <YOUR_API_KEY>"

Example response:

{
  "id": 19554189106348032,
  "sourceId": 347816547721216,
  "name": "booking",
  "profile": false,
  "event": false,
  "schema": {
    "type": "record",
    "name": "booking",
    "namespace": "customSource",
    "doc": "Booked room",
    "fields": [
      {
        "name": "id",
        "type": "long"
      },
      {
        "name": "dateFrom",
        "type": {
          "type": "string",
          "logicalType": "date"
        }
      },
      {
        "name": "dateTo",
        "type": {
          "type": "string",
          "logicalType": "date"
        }
      },
      {
        "name": "guestId",
        "type": "long"
      },
      {
        "name": "roomId",
        "type": "long"
      }
    ]
  },
  "_links": {
    "self": {
      "href": "https://api.intempt.com/v1/your-org/collections/19554189106348032"
    },
    "data": {
      "href": "https://api.intempt.com/v1/your-org/collections/19554189106348032/data"
    },
    "byName": {
      "href": "https://api.intempt.com/v1/your-org/collections?{name}",
      "templated": true
    }
  }
}

This endpoint retrieves a specific collection.

HTTP Request

https://api.intempt.com/v1/your-org/collections/<ID>

URL Parameters

Parameter Description
ID The ID of the collection to retrieve

Success Response

This call will return a collection object that contains id, sourceId, name, profile, event and schema properties, alongside with the _links object.

schema property defines the schema of this collection, all collection data items have to follow this schema.

sourceId property shows to which Source this collection belongs.

profile property shows whether collection is a user profile.

event property shows whether collection is an event. Key difference of event type collection is that it has many-to-one relation with a profile. If event is true, having a relation with a profile collection is necessary.

In the _links object self points to the collection itself, data points to the data in this collection, byName link points to a specific collection finding by its name.

Create a collection

curl "https://api.intempt.com/v1/your-org/collections"
  -d 
  '{
    "sourceId": 347816547721216,
    "name": "booking",
    "schema": {
      "type": "record",
      "name": "booking",
      "namespace": "customSource",
      "doc": "Booked room",
      "fields": [
        {
          "name": "id",
          "type": "long"
        },
        {
          "name": "dateFrom",
          "type": {
            "type": "string",
            "logicalType": "date"
          }
        },
        {
          "name": "dateTo",
          "type": {
            "type": "string",
            "logicalType": "date"
          }
        },
        {
          "name": "guestId",
          "type": "long"
        },
        {
          "name": "roomId",
          "type": "long"
        }
      ]
    }'
  -X POST
  -H "Authorization: ApiKey <YOUR_API_KEY>"

Example response:

{
  "id": 19554189106348032,
  "sourceId": 347816547721216,
  "name": "booking",
  "profile": false,
  "event": false,
  "schema": {
    "type": "record",
    "name": "booking",
    "namespace": "customSource",
    "doc": "Booked room",
    "fields": [
      {
        "name": "id",
        "type": "long"
      },
      {
        "name": "dateFrom",
        "type": {
          "type": "string",
          "logicalType": "date"
        }
      },
      {
        "name": "dateTo",
        "type": {
          "type": "string",
          "logicalType": "date"
        }
      },
      {
        "name": "guestId",
        "type": "long"
      },
      {
        "name": "roomId",
        "type": "long"
      }
    ]
  },
  "_links": {
    "self": {
      "href": "https://api.intempt.com/v1/your-org/collections/19554189106348032"
    },
    "data": {
      "href": "https://api.intempt.com/v1/your-org/collections/19554189106348032/data"
    },
    "byName": {
      "href": "https://api.intempt.com/v1/your-org/collections?{name}",
      "templated": true
    }
  }
}

Use this endpoint to create a new collection.

In the ruqest body you will need to specify:

sourceId property, which shows to which Source this collection belongs.

name - collection name.

schema - defines the schema of this collection, all collection data items have to follow this schema.

profile - shows whether collection is a user profile.

event - shows whether collection is an event. Key difference of event type collection is that it has many-to-one relation with a profile. If event is true, having a relation with a profile collection is necessary.

HTTP Request

POST https://api.intempt.com/v1/your-org/collections

Success Response

If successful, this call will return a collection object that contains id, sourceId, name, profile, event and schema properties, alongside with the _links object.

schema property defines the schema of this collection, all collection data items have to follow this schema.

sourceId property shows to which Source this collection belongs.

profile property shows whether collection is a user profile.

event property shows whether collection is an event. Key difference of event type collection is that it has many-to-one relation with a profile. If event is true, having a relation with a profile collection is necessary.

In the _links object self points to the collection itself, data points to the data in this collection, byName link points to a specific collection finding by its name.

Delete a Collection

curl "https://api.intempt.com/v1/your-org/collections/194123921"
  -X DELETE
  -H "Authorization: ApiKey <YOUR_API_KEY>"

This endpoint deletes a specific collection.

HTTP Request

DELETE https://api.intempt.com/v1/your-org/collections/<ID>

URL Parameters

Parameter Description
ID The ID of the collection to delete

Success Response

On successful delete, the deleted collection will be sent in the response.

Collection data

Collection data endpoint is used to work with data items in a collection.

Before storing data items, you will need to create a collection with a schema for this particular type of data.

Get All Data in a Collection

curl "https://api.intempt.com/v1/your-org/collections/19554189106348032/data"
  -H "Authorization: ApiKey <YOUR_API_KEY>"

Example response:

{
  "_embedded": {
    "dataItemList": [
      {
        "collId": 19554189106348032,
        "id": 24665844119130112,
        "data": {
          "id": 2,
          "dateFrom": "2019-10-25",
          "dateTo": "2019-12-25",
          "guestId": 123123213,
          "roomId": 312312312
        },
        "matches": [],
        "_links": {
          "self": {
              "href": "https://api.intempt.com/v1/your-org/collections/19554189106348032/data/24665844119130112"
          }
        }
      },
      {
        "collId": 19554189106348032,
        "id": 24663674875432960,
        "data": {
          "id": 4,
          "bookingDate": -1,
          "guestId": 2,
          "roomId": 10
        },
        "matches": [],
        "_links": {
          "self": {
              "href": "https://api.intempt.com/v1/your-org/collections/19554189106348032/data/24663674875432960"
          }
        }
      }
    ]
  },
  "_links": {
    "self": {
      "href": "https://api.intempt.com/v1/your-org/collections/19554189106348032/data"
    }
  }
}

This endpoint retrieves all data items for selected collection.

In current example, this call retrieves all room booking records.

HTTP Request

GET https://api.intempt.com/v1/your-org/collections/19554189106348032/data

Success Response

This call will return an array of collection objects that contain id, collId, data, matches properties, alongside with child _links object.

collId property shows which collection this data item belongs to.

data is actual data payload.

In the _links object self points to the collection data item itself.

The root _links object's self property points to the list of data items.

Get a Specific Data Item

curl "https://api.intempt.com/v1/your-org/collections/collection-id/data/data-item-id"
  -H "Authorization: ApiKey <YOUR_API_KEY>"

Example response:

{
    "collId": 19554189106348032,
    "id": 24663674875432960,
    "data": {
        "id": 4,
        "bookingDate": -1,
        "guestId": 2,
        "roomId": 10
    },
    "matches": [],
    "_links": {
        "self": {
            "href": "http://localhost:8081/v1/intempt-test/collections/19554189106348032/data/24663674875432960"
        }
    }
}

This endpoint retrieves a specific data item.

HTTP Request

GET https://api.intempt.com/v1/your-org/collections/<ID>/data/<DATA-ITEM-ID>

URL Parameters

Parameter Description
ID The ID of the collection to retrieve data from
DATA-ITEM-ID The ID of the data item to retrieve

Success Response

This call will return an array of collection objects that contain id, collId, data, matches properties, alongside with child _links object.

collId property shows which collection this data item belongs to.

data is actual data payload.

In the _links object self points to the collection data item itself.

Add a collection data item

curl "https://api.intempt.com/v1/your-org/collections/collection-id/data"
  -d '{
         "id": 4,
         "bookingDate": -1,
         "guestId": 2,
         "roomId": 10
       }'
  -X POST
  -H "Authorization: ApiKey <YOUR_API_KEY>"

Example response:

{
  "collId": 19554189106348032,
  "id": 24663674875432960,
  "data": {
    "id": 4,
    "bookingDate": -1,
    "guestId": 2,
    "roomId": 10
  },
  "matches": [],
  "_links": {
    "self": {
        "href": "http://localhost:8081/v1/intempt-test/collections/19554189106348032/data/24663674875432960"
    }
  }
}

Use this command to add a new data item to a collection:

The data object included in the request body has to match collection schema.

Fields that are not present in the collection schema will be ignored.

HTTP Request

POST https://api.intempt.com/v1/your-org/collections/<ID>/data

URL Parameters

Parameter Description
ID The ID of the collection to retrieve data from
DATA-ITEM-ID The ID of the data item to retrieve

Success Response

On successful call, saved data item object will be return in the response.

Delete a Collection data item

curl "https://api.intempt.com/v1/your-org/collections/194123921/data/24663674875432960"
  -X DELETE
  -H "Authorization: ApiKey <YOUR_API_KEY>"

This endpoint deletes a specific collection data item.

HTTP Request

DELETE https://api.intempt.com/v1/your-org/collections/<ID>/data/<DATA-ITEM-ID>

URL Parameters

Parameter Description
ID The ID of the collection to delete data item from
DATA-ITEM-ID The ID of the data item to delete

Success Response

On successful delete, the deleted collection will be sent in the response.

Errors

Intempt API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- Your API key is correct but access is forbidden.
404 Not Found -- The specified data could not be found.
405 Method Not Allowed -- You tried to access data with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
410 Gone -- The data requested has been removed from our servers.
429 Too Many Requests -- You're sending too many requests! Slow down!
500 Internal Server Error -- We had a problem with our server. Please try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.

Client-side API overview

Customization for Web

This guide explains how to interact with the Intempt JavaScript API.

JS Overview

When you add the default tracker code to a website, it handles tracking and notifications automatically. This allows for a completely plug-and-play experience.

The tracker code also exposes an API allowing you to:

Tracker Code

window.addEventListener("intempt.YOUR_TRACKER_NAME.ready", function() {
  //do something when tracker has been loaded;
  //the tracker object becomes accessible at window.intempt["site"] after loading;
});
!function(a,b){if(window.__intempt&&window.intempt)a&&(window.__intempt.init_tracker?window.__intempt.init_tracker(a):window.__intempt.startup_configs.push(a));else{window.__intempt={},window.__intempt.startup_configs=[],a&&window.__intempt.startup_configs.push(a);var c=document.createElement("script");c.type="text/javascript",c.async=!0,c.src=b||"https://cdn.intempt.co/intempt.min.js";var d=document.getElementsByTagName("script")[0];d.parentNode.insertBefore(c,d)}}({orgId:"YOUR_ORG_NAME",trackerId:"YOUR_TRACKER_NAME",token:"YOUR_TRACKER_TOKEN"});

Add the following code to your site, preferably in the <head>.

You can get an automatically generated version of this code, with your account-specific variables filled in, from the tracker setup page in the Intempt app.

Tracker Object

The tracker object is accessible with:

window.intempt["TRACKER_NAME"]

The TRACKER_NAME string is the name as specified in the Intempt app.

if (window.intempt && window.intempt['YOUR_TRACKER_NAME']) {
  // Perform your tracker operations here
}

Identifying Visitors

window.intempt["TRACKER_NAME"].identify({
    identifier: 'CUSTOM_IDENTIFIER'
})

Our tracking code automatically sets a unique ID for each visitor, and attempts to link multiple visits to the same visitor by setting a cookie in the browser.

To track visitors across multiple browsers and apps (or sessions after cookies are removed), pass in a unique identifying code (user email, unique user ID in your database etc.).

You can pass additional key-value pairs to identify, but identifier is the one that defines a unique identity. Other key-value pairs passed in can be used for data queries and segmenting in the Intempt app.

Tracking Categories and Products

Visitor activity on the page can be scoped by introducing categories and products. This might come in handy when, for instance, you would like to understand differences between visitor activities for different categories or products pages, or when you simply want to know for notification purposes, which is the current one.

All you need to track categories and products is changing the tracked JS variables - our tracker will create the context and persist it automatically. You can either set both, or set one of them:

window.intempt_category = 'my-category'; // sets the category for current page
window.intempt_product = 'my-product'; // sets the product for current page

To reset category and product, simply purge values from these variables (if your website is multi-page application, that is done automatically upon page transition):

window.intempt_category = undefined; // sets the category for current page
window.intempt_product = undefined; // sets the product for current page

 

You can also use Object to track some additional properties both for categories and for products. In such case the requirement is that this object must contain field name with string in it, like this:

window.intempt_category = {
    name: 'my-category', // required field, must contain string
    property1: 'some value 1',
    property2: 'some value 2'
};
window.intempt_product = {
    name: 'my-product', // required field, must contain string
    property1: 'some value 1',
    property2: 'some value 2'
};

 

You also can create events for visitors actions, that cause changes to categories and products using Custom action type, and in subsequent menu picking category_changed or product_changed.

 

Recording Custom Events

Our client-side API allows creation of any event type you might desire to be tracked for your page or application.

Custom collections was designed to allow you bring custom data into some Intempt-built event collections (like Visitor, Visit, Identify) and bring in your own collections.

After you select this event type, next to it you can see a dropdown list with all the collections, that have not been covered by our other event types. After a collection has been selected, by clicking Filter button you can add filters for and of the properties that you (or we for Intempt-defined collections) might have tracked for this collection.

Intempt automatically tracks a number of on page events. You can log a custom event by calling track, passing in a set of key-value pairs.

window.intempt["TRACKER_NAME"].track("COLLECTION_NAME", {
    "your.property": "your value"
})

The COLLECTION_NAME refers to an event type. For example, if you wanted to log every purchase made on your site, you might call that collection "purchase". Then, when a purchase happens, you call track and pass in the purchase details.

window.intempt["YOUR_TRACKER_NAME"].track("purchase", {
     "items": [{"item name": "item 1","price": 20}, {"item name": "item 2","price": 15}]
     "totalprice": 35,
     "ispaid": true,
     "timestamp": new Date().getTime(),
     "fixed.name": "John Smith",
     "fixed.age": 28,
     "intempt.visit.trackcharge": 35
})

Tracking Revenue with trackcharge

Notice the key intempt.visit.trackcharge in the sample code above. If you use this key in the event details, the value will be recorded as revenue in the Intempt app. This allows you to assess the revenue impact of campaigns.

Collections do not need to be predefined in the Intempt app. As soon as the tracker logs an event with a new collection name, that collection of events will be available in the app.

Events, Collections, and Properties

An event is a discrete interaction that occurs on your site. Events are organized by type into collections. Events have properties, key-value pairs that record relevant information about the event.

For example, a user clicks on a link:

The tracker code, once installed on a website, will automatically record many events that occur on the site.

Tracker Events

On the JS side, events will soon be renamed to actions.

Event collections are organized in a tree structure.

Because of this hierarchy, any event can be filtered or accessed based on the properties associated with something further up the tree.

For example, if you wanted to find all button clicks associated with a particular visit, you can do that.

Custom events logged manually using the JavaScript API appear with whatever collection name was assigned, under the custom collection.

Properties

Events have properties, key-value pairs the record information about the event.

Properties are grouped into two collections: