Coded properties is a Convizit capability that allows you to add your own properties to specific user activity events that Convizit captures automatically. Each coded property consists of a name:value pair.
Coded properties are delivered together with all of the other details that Convizit sends to your destination systems in connection with the particular event.
Note that coded properties enhance events that Convizit captures automatically. To generate your own coded events (containing coded properties, of course), see Coded Events.
Adding Properties to Events Generated by an Element
To add coded properties to events automatically captured by Convizit, your webserver needs to add a special HTML attribute named data-cprops
(“cprops” is an abbreviation for “Convizit properties”) to the HTML tag of the particular element generating the event. The content of the data-cprops
attribute is one or more comma-separated name:value pairs, in JSON syntax:
data-cprops='{"property name 1": "property value 1", "property name 2": "property value 2"}'
For example, if you have an add-to-cart button coded using the following HTML tag:
<button class='product-add-to-cart button' id='95475189.8424'>Add to cart</button>
you would add the following attribute to the button’s HTML tag:
data-cprops='{"Product SKU": "73517422", "Price": 199.95, "Currency": "USD"}'
Thus, the button’s enhanced HTML tag would look like this:
<button class='product-add-to-cart button' id='95475189.8424' data-cprops='{"Product SKU": "73517422", "Price": 199.95, "Currency": "USD"}'>Add to cart</button>
Implementation Notes
- You may include up to 50 name:value pairs in the data-cprops attribute.
- Each property name must be a string, maximum 255 characters
- Property values may be any of:
- String, maximum 255 characters
- Number
- Boolean
- Null
- It is important that the JSON content of data-props attribute be enclosed by single quotation marks (‘) in order that that the individual names and values within it conform to the JSON standard of being enclosed by double quotation marks (“).
- In most cases, the easiest way to add the
data-cprops
attribute to the desired HTML tags is by directly updating the HTML code generated by the webserver. - Another option is to programmatically add the HTML attribute to the desired HTML tags at run time (using the client-side JavaScript added to the page). For example, you could add the
data-cprops
attribute to the HTML tag<button class="product-add-to-cart button" id="73517422">Add to cart</button>
using JavaScript code similar to this: