- 28 Dec 2023
- 2 Minutes to read
Product Object
- Updated on 28 Dec 2023
- 2 Minutes to read
Product Object includes the product properties. If the product properties are changeable without reloading the page, this object must be updated too. The product object must be implemented on the pages where a single product is displayed.
What are the prerequisites?
- Insider tag must be implemented.
- Insider object must be defined before the Insider tag. Otherwise Insider tag cannot read any information from the Insider object.
What are the properties?
The Product object has the following properties.
Key | Property | Type | Definition | Required |
---|---|---|---|---|
id | Product ID | String | Unique product ID | Yes |
name | Product Name | String | Name of the product | Yes |
taxonomy | Breadcrumb | Array | Category tree of the product | Yes |
currency | Currency | String | Currency used for product pricing, in ISO 4217 format (e.g. USD) | Yes |
unit_price | Product price without any discount(s) | Float | Price of the product without any discount(s) | Yes |
unit_sale_price | Unit price | Float | Unit price of the product | Yes |
url | Product page link | String | URL address of the product | Yes |
stock | Stock information | Number | Number of products left in stock | No |
color | Product color | String | Color of the product (selected by user) | No |
size | Product size | String | Size of the product (selected by user) | No |
product_image_url | Product image link | String | URL address of the product image | Yes |
custom | Custom | Object | Custom object that includes custom properties to be collected to Insider database as custom event parameters | No |
What are the things to keep in mind?
When integrating the object, the following factors should be considered.
- window.insider_object.product object should return on the page.
- After running window.insider_object.product.type on browser console, the page object should return the type as Product.
- window.insider_object.product.taxonomy should return the correct breadcrumb hierarchy.
- The object should update the product information when the product changes.
Sample Code
Below is a sample code for the Product object.
window.insider_object = window.insider_object || {};
window.insider_object.product = {
"id": "abc1234",
"name": "Blue Dress",
"taxonomy": [
"Dresses",
"Night Dresses",
"Long Sleeve"
],
"currency": "USD",
"unit_price": 100.00,
"unit_sale_price": 95.20,
"url": "http://www.mywebsite.com/en-US/product/abc1234/",
"stock": 11,
"color": "Blue",
"size": "S",
"product_image_url": "http://www.mywebsite.com/product_images/abc1234.png",
"custom": {
"merchandiser": "store123"
}
}
In addition to the properties defined in the table above, you can add custom properties to any object. Such properties should be added under the custom object as in the example above.
How can I monitor if it works correctly?
Once you deploy your integration, you can test it via different methods.
Insider Object Integration Wizard
This wizard helps you complete your integration and test it afterwards. If you have already implemented the integration, you can use the wizard only to test it as well. See more on the Insider Object Integration Wizard.
Browser Test
You can visit your website and navigate to a product page to test the Product object.
- Right click on your website to inspect the page.
- Go to Developer Console.
- Run insider_object or insider_object.product to see your object.
- Make sure that it follows the criteria stated in the properties.