# Track: improving results by reporting customer behavior

This action allows you to notify Visii of how the end user interacts with Visii recommendations. To see which events will get you access to a personal client Dashboard, check the Events page.

Endpoint

We recommend using the va.js library to take care of all of these events.

# Why track your customers

Being able to reconstruct a customer's journey across your site, we are able to:

  • Provide the best customer experience and solve findability on your website
  • Intuit which products and features interest a customer, and which do not
  • Learn from their experience, purchases and interactions to provide the best product recommendations for all visitors
  • Ensure their experience improves upon each subsequent visit
  • Improve our algorithm and technology so you continue receiving the best-in-class service

Privacy

Please be mindful not to send any personally identifiable information, and to review our section on privacy. We provide information to share with your customers to inform them about how we use their data. By sending us your customer information indicates you have their consent, as outlined in our Data Processing Agreement.

User tracking

We request that you send a GDPR compliant page_view_id value when requesting results from the Vision API.

Once a user consents, add the anonymous_id and user_id so these can be mapped to purchases.

Other event properties detailed can also be passed in the v query string parameter when using the Vision API endpoints.

E.g. /explore?v=user_id:7462402,page_type:pdp,page_view_id:123456789

# Input

Endpoint

POST /orgs/:organisation/datasets/:dataset/track

Field Type Required Value Description
organisation String yes The organisation name
dataset String yes The dataset name

# Body

Field Type Required Value Description
message String yes The event name, consult the Events page
data Object no Additional event properties, consult the Events page

# Example

{
  message: "Page Loaded",
  data: {
    anonymous_id: "8c772995-b629-4051-a4e9-b7a30dbe5b32",
    user_id: "7462402",
    user_ip: "123.124.125.xxx",
    page_url: "https://www.my-website.com/products/my-awesome-product",
    page_referrer: "https://www.my-website.com",
    page_user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) ...",
    page_type: "pdp",
    timestamp: 1577836800000,
    ab_tests: [
      {
        name: "visii-recommends",
        group: "visii"
      },
      {
        name: "homepage-cta",
        group: "control"
      }
    ]
  }
}

# Request

Note

my-dataset-api-token is a dataset token, not an organisation token

curl -X POST \
     -H "Authorization: token my-dataset-api-token" \
     -H "Accept: application/vnd.visii.v2+json" \
     -d '{"message":"Page Loaded"}' \
     "https://api.visii.com/orgs/my-org/datasets/my-dataset/track"
// consider using the Visii Analytics library (va.js) - which adds many fields for you.
var headers = {
	"Accept": "application/vnd.visii.v2+json",
	"Authorization": "token <browser-token>"
};
var bodyData = {
	message: "Widget Viewed",
	data: {
		anonymous_id: "8c772995-b629-4051-a4e9-b7a30dbe5b32",
		user_id: "7462402",
		user_ip: "123.124.125.xxx",
		page_url: "https://www.my-website.com/products/my-awesome-product",
		page_referrer: "https://www.my-website.com",
		page_user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) ...",
		page_type: "pdp",
		page_view_id: 157783680000012345,
		product_id: "232342",
		timestamp: 1577836800000,
		ab_tests: [
			{
				name: "visii-recommends",
				group: "visii"
			},
			{
				name: "homepage-cta",
				group: "control"
			}
		],
		products_on_page: [
			{
				id: "245238456",
				section: "recently_viewed"
			},
			{
				id: "396734874",
				section: "recently_viewed"
			}
		]
	}
};

window.fetch("https://api.visii.com/orgs/<org>/datasets/<dataset>/track", {
	method: "POST",
	mode: "cors",
	cache: "no-cache",
	credentials: "omit",
	keepalive: true,
	headers: headers,
	body: JSON.stringify(bodyData)
});

# Response

Field Type Value Description
status String The status of the response
HTTP/1.1 200 OK
{
  "status": "ok"
}
Last Updated: 12/20/2021, 12:19:51 PM