Behavior Tracking > Custom Action Tracking
Custom Action Tracking
onespot-actiondata attribute. If you would like OneSpot to track and report on specific actions, such as clicks to a button, or form submissions, then you can instrument this tracking directly in your HTML.
view productbutton on your website; for example your button may like this:
For the purposes of this example it doesn’t matter where this HTML button came from, you could have created it yourself or it could be powered by your CMS or some other 3rd party service on your site. The important thing is that clicking on the button is an action you would like to report on, perhaps you want to answer questions like:
- What percentage of users click on view product buttons?
- Are visitors that view more of our editorial content more likely than others to click this button?
These are reports that OneSpot can help you with, but first you will have to
- Have the OneSpot tracking Tag installed on the page where the action happens and
- Add some extra HTML markup to the button. The examples below show you how to do this
click-view-productand also associate the name of the product as a property of the action
This tells OneSpot that in addition to tracking the click on the button and the product name, the price should be tracked as a custom value for the item.
Value must be a numeric value, if you pass in a value that is not numeric then the tracking will fail.
onespot-action-valueattributes are optional, but the
onespot-actionattribute is required on all actions.
|data attribute||description||required?||value type|
||The name of the action being tracked. See "Naming Actions" below for more information. Example: tracking add to cart button
||A property associated with an action. Example: the name of the product being added to cart
||The value associated with an action. Example: the price of the product
||false||string that can be coerced to number. See examples.|
Actions should have descriptive names, with words separated by hyphens. We suggest prefixing action names with the type of action tracked (click or submit).
onespot-actiondata attribute. The value of this attribute should be the name of the action to be tracked.
onespot-actiondata attribute. The data attribute must be added to the main
onespot-actiondata-attributes are recorded at the time of the form submission or click. If you would like to track things like total cart value, for example, you can change the value of the
OneSpot will only track submission events on forms when the
onespot-action data attribute is on the
form wrapper, we suggest tracking clicks to a button that is used to initiate submission. See example below.
_onSiteQas shown below, then use
_onSiteQ.push(fn)to add functions to the queue for execution when the Onsite script has been loaded, or immediately execute if the script is already loaded.
pushmethod. See example.
||Custom Action Parameters (see below)|
|label||The name of the action being tracked. See "Naming Actions" below for more information. Example: tracking add to cart button
|property||A property associated with an action. Example: the name of the product being added to cart
|value||The value associated with an action. Example: the price of the product
You should choose descriptive names for your actions - these distinguish different events/goals in reporting and analysis. Do not copy/paste the example values (i.e. "click-add-to-cart") that are used in the code samples.
See the section below on "Naming Actions"