Follow

JSON Data Fields

In our JSON data model, we have several data attributes that records the user activity. Next, we will describe each data field, and in what circumstances, page types or desired user behaviors you need to fulfill them.

 

Data field Page type Description
pagetype all This data field is used to communicate BrainSINS what type of page the user is browsing. You need to replace PAGE_TYPE by one of the following values:
  • product: When the user is browsing a product page.
  • home: When the user is browsing the homepage.
  • category: When the user is browsing a category listing.
  • cart: When the user is at the cart page.
  • checkout: When the user is at the first page of the checkout process. Sometimes this page is the cart page, so in that situation you must use the "checkout" page type.
  • thankYou: When the user has completed the purchase.
  • login: When the user has been redirected to a specific page after the log-in process.

As an example, if the user is browing the homepage, this JSON line would contain: 

  • pagetype: "home",
language all If your online storefront manages different languages, you can specify in this field in what language the user is browsing your website. That is needed to show the recommended products details in the proper language. If you have different languages in your online store, you must consider that you need to configure your products feed to send us the information in every language you manage. As an example, imagine that a user is visiting your online store and has chosen to read the contents in Spanish. If you have configured the Spanish language in your catalog using the code "es", you'd need to add the following line to the JSON:
  • language: "es",
productId product When the user is browsing a product page, the productId field contains the internal id of the product. This id must match the id that you use for that product in the products feed. As an example, if the user is browsing the page for the product with id 676, the JSON code should include:
  • pagetype: "product",
  • productId: 676,
totalAmount thankYou When the user finishes a purchase, totalAmount is used to state the final amount for the given purchase. We use this data mainly for analytical purposes. As an example, if the user has finished a purchase of $1,249.32, you should send us that information as a float:
  • pagetype: "thankYou",
  • totalAmount: 1249.32,
categories

category

(all)

Categories is used to send BrainSINS a given category or set of categories. Mostly, you'll be needing this field to send the category the user is browsing in a given moment. As an example, if the user is browsing the category listing for shirts in your online store, you'd include the following lines in our JSON:
  • pagetype: "category",
  • categories: "shirts",

If the user is not browsing the category listing, you can also include the categories field in order to restrain recommendations results according to that category. Although you may learn more about filtering recommendations results in the "Recommender Object" documentation.

As an example, Imagine that you want to show product recommendations in your homepage but you need that the recommended products belong to the categories christmas or holidays. You should include the following code:

pagetype: "home",
categories: "christmas, holidays",
recommenders: [
{
recommenderId: 13,
location: "recommendation-home",
position: "replace",
filter: "any"
}],
You must consider that BrainSINS associates categories to the products according to the information you send in your products feed. So you must be consistent in the use of categories.
userEmail any We are able to gather user emails and associate them to browsing sessions, so you can configure email retargeting rules to recover abandoned carts, or even send personalized newsletters. When you need to send us a user email because the user has logged-in in your website, or they have introduced their email in a newsletter subscription form, you should include the user's email in this field. Most times, you'll be sending the email in the login page, so the following example is made based on this assumption. But if you want to send us a user email from any other type of page, you only need to add the field userEmail containing the user's email address.
  • pagetype: "login",
  • userEmail: "user@domain.com",
userNewsletter any This field is a modifier to userEmail, and must be used only to notify that a given user doesn't want to receive any eMail communications. As an example, if a user with the email address user@domain.com registers at our site but does not want to receive any email communication, you should include the following code:
  • pagetype: "login",
  • userEmail: "user@domain.com",
  • userNewsletter: 0,
cart cart

The cart field is used to send BrainSINS information about the cart's content of a given user. Mostly you will be using this field when the user is in the cart page, visualizing their cart's content. If a given user has added 1 unit of the product with id=13 and 3 units of the product with id=27, you should include the following code:

pagetype: "cart",
cart: {
products: [
{
id: 13,
quantity: 1
},
{
id: 27,
quantity: 3
}]
}

This field contains a list of N pairs {id, quantity}, being N the number of different products in the user's cart. Although the main use of this field is expected for the cart page, you can include this field wherever you want to track the carts content of a given user. In some cases, you'd like to synchronize the cart contents when the checkout starts, in that situation you'd need to include the following code (assuming the same cart's contents of the previous example):

pagetype: "checkout",
cart: {
products: [
{
id: 13,
quantity: 1
},
{
id: 27,
quantity: 3
}]
}

 

recommenders any This field is used when you want to show product recommendations in a given page type. The following is an example of how it should be created with just the essentials to work:
        recommenders: [ {
recommenderId: ID,
location: LOCATION,
position: POSITION
}]

How to configure the parameters:

  • recommenderId: the id of recommender. You can find it in recommenders list.
  • location: referential html element. You can use id or class of the element. It should be refereed as jQuery or CSS with "." for classes and "#" for id.
  • position: can be "before", "after", "replace", "first" or "last".

You also can use the following parameters in order to give recomenders more accuracy:

  • categories: this is a typical parameter of category page but you can use it inside a recommender object in other pages to filter by one or more categories (separated by commas). This parameter only affect the concrete recommender where it's placed.
  • filter: can be "any", "all" or "forbid". If you don't configure it, the categorie parameter won't have effect. You also can use it in recommenders in category page with the categories parameter outside recommender object. 

    • any: recommender will show products that contain almost one category.
    • all: the products must contain every category from categories parameter to be shown in recommenders.
    • forbid: products with the same categories as categories parameter won't be shown in recommenders.

For instance, if you want two recommenders in home page, one with recommender id 1 (Based on your last item visited) and the second one with id 2 (Top Selling): 

<script type="text/javascript">    
var BrainSINSData = {       
pageType:"home",       
recommenders: [ {
recommenderId: 1,
location: "#brainsins_rec",
position: "replace"
},{
recommenderId: 2,
location: ".main_row",
position: "after",
categories: "t-shirt,red",
filter: "forbid"
}
]
};
</script>

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk