Saving events

To register events in Trustisto you need to call our JavaScript code.

On the page where the event occurs, there should be the main script installed. Without it, none of the code you see below will work properly.

To register an event call SP.go('push', event, params). The first parameter is an command. push command is responsible for registering events. The second parameter is an event name (string type), and third is a hash with parameters.

You should call SP.go('push', ...) after you will call the main script. If you call it before the main script, nothing happens.

<script type="text/javascript">
  SP.go('push', 'buy', {
    productId: 1,  // Item/Product ID (optional)
    name: 'John',  // Additional parameter
    city: 'New York'
  })
</script>

Event parameters

  • productId (type: string or number, optional) - store item/product identifier, it describes an item, only if the event is related to it example: view item, buy the item. Value should be unique within a single website

  • additional parameters (type: string/number, optional, max 1024 characters) - additional parameter for particular event. You can send up to 20 parameters per event (including productId)

Standard events

There are 6 standard events that are registered out of the box:

  • home - viewing homepage
  • view - viewing product card (productId parameter is sent)
  • buy - purchasing product (productId parameter is sent)
  • category - viewing category page
  • search - viewing search result
  • basket - viewing basket page

Next step >> Helper functions

results matching ""

    No results matching ""