Event Tag - Server side

Implementing the Tweakwise Event Tag is an essential step for us to analyze the performance of your configuration, power our insights reports and support personalization. To support this, we need key e-commerce events on your platform. These are events such as product views, item clicks, add-to-carts, and purchases.

To make full advantage of the reporting features, track:

  • session starts so we can establish a neutral baseline
  • page impressions on lister pages, search result pages, displaying recommendations or guided selling.
  • item clicks on lister pages, search result pages and recommendations.
  • search phrases on search result pages
  • product views when viewing a item (product detail page)
  • add to cart when a product is added to the cart
  • add to wishlist when a product is added to a wishlist/favorited
  • purchases when a conversion is done (order is placed)

Before you begin

Some events require a ProductKey. This is not your shop’s SKU or internal ID, but the item ID as known in Tweakwise.

Before sending events, make sure these match up:

  • Use the correct identifier: the ProductKey must match the item ID in your Tweakwise feed. If it doesn’t, the event won’t link to the right product.
  • Check for multi-store setups: in multi-language or multi-store environments, the item key often includes a storeview prefix (for example 1000102345 or 1000202345). Always send the key with the correct prefix for that storeview.

Events

Session start

To be able to connect customer behaviour to session behaviour, send a sessionstart event whenever a new session is started for the specific user.

Note: a session can be considered "new" after 30 minutes of inactivity.

Property

Type

Required

Value / description

ProfileKey

Text

yes

The profile key identifying the visitor.

SessionKey

Text

no

The sessionkey for the specific user. This can be your own sessionkey, GA session. As long as it's consistent over the users' session. Allowed characters: alphanumeric and hyphens (hts Tag is j)

curl --request POST \
     --url https://navigator-analytics.tweakwise.com/api/sessionstart \
     --header 'Instance-Key: INSTANCEKEY' \
     --header 'content-type: text/json' \
     --data '
{
  "ProfileKey": "twfg$ae12deH8631552",
  "SessionKey": "jfAbyWef52319mDfa"
}
'
💡

Note: when using Event Tag - Client side this is working out of the box. It might be worth considering just using the client side library to support this event.

Search

To measure the amount of search queries, send a search event when a user enters a search term, including the term the user has entered.

Property

Type

Value / description

SearchTerm

Text

The search term the visitor used to search for products.

ProfileKey

Text

The profile key identifying the visitor.

SessionKey

Text

The sessionkey for the specific user. This can be your own sessionkey, GA session. As long as it's consistent over the users' session. Allowed characters: alphanumeric and hyphens (hts Tag is j)

curl --request POST \
     --url https://navigator-analytics.tweakwise.com/api/search \
     --header 'Instance-Key: INSTANCEKEY' \
     --header 'content-type: text/json' \
     --data '
{
  "SearchTerm": "jeans",
  "ProfileKey": "twfg$ae12deH8631552",
  "SessionKey": "jfAbyWef52319mDfa"
}
'

Click product

To measure how many times an item is clicked, send a itemClick event whenever a user clicks/taps an item. This should be implemented on search results & lister pages.

Property

Type

Value / description

RequestId

Text

The identifier of the linked Tweakwise request (see requestId )

ItemId

Text

The Tweakwise id of the clicked product/item.

SessionKey

Text

The sessionkey for the specific user. This can be your own sessionkey, GA session. As long as it's consistent over the users' session. Allowed characters: alphanumeric and hyphens (hts Tag is j)

curl --request POST \
     --url https://navigator-analytics.tweakwise.com/api/itemclick \
     --header 'Instance-Key: INSTANCEKEY' \
     --header 'content-type: text/json' \
     --data '
{
  "RequestId": "d03c40f5-6894-4e4f-9cd8-95d4efe38eaa",
  "ItemId": "item123",
  "SessionKey": "jfAbyWef52319mDfa"
}
'

View product

To measure how many times item details are viewed, send a pageview event whenever a user views an item’s details screen.

Property

Type

Required

Value / description

ProductKey

Text

yes

The unique id of the item known at Tweakwise

ProfileKey

Text

yes

The profile key identifying the visitor.

SessionKey

Text

no

The sessionkey for the specific user. This can be your own sessionkey, GA session. As long as it's consistent over the users' session. Allowed characters: alphanumeric and hyphens (hts Tag is j)

curl --request POST \
     --url https://navigator-analytics.tweakwise.com/api/pageview \
     --header 'Instance-Key: INSTANCEKEY' \
     --header 'content-type: text/json' \
     --data '
{
  "ProductKey": "3129",
  "ProfileKey": "twfg$ae12deH8631552",
  "SessionKey": "jfAbyWef52319mDfa"
}
'

Purchase

The purchase event tracks the transaction of your customers. It is crucial for analyzing the overall performance of algorithm usage, builder, filter templates and more.

Property

Type

Value / description

ProductKeys

List of Text

Array of unique id's of the items (known at Tweakwise) in the transaction

ProfileKey

Text

The profile key identifying the visitor.

Revenue

Number

The total revenue from the purchase, calculated as the sum of product prices after discounts have been applied and before taxes are added. Can be empty, or must contain a value greater than or equal to 0.

SessionKey

Text

The sessionkey for the specific user. This can be your own sessionkey, GA session. As long as it's consistent over the users' session. Allowed characters: alphanumeric and hyphens (hts Tag is j)

curl --request POST \
     --url https://navigator-analytics.tweakwise.com/api/purchase \
     --header 'Instance-Key: INSTANCEKEY' \
     --header 'content-type: text/json' \
     --data '
{
  "ProductKeys": [
    "3129",
    "6471"
  ],
  "Revenue": 124.50,
  "ProfileKey": "twfg$ae12deH8631552",
  "SessionKey": "jfAbyWef52319mDfa"
}
'

Add to cart

The addtocart event tracks cart additions.

Property

Type

Value / description

ProfileKey

Text

The profile key identifying the visitor.

SessionKey

Text

The sessionkey for the specific user. This can be your own sessionkey, GA session. As long as it's consistent over the users' session. Allowed characters: alphanumeric and hyphens (hts Tag is j)

ProductKey

Text

The unique id of the item known at Tweakwise

Quantity

Number

TotalAmount

Number

The total sum (price * amount) from the product added to the cart.

curl --request POST \
     --url https://navigator-analytics.tweakwise.com/api/addtocart \
     --header 'Instance-Key: INSTANCEKEY' \
     --header 'content-type: text/json' \
     --data '
{
  "ProductKey": "3129",
  "TotalAmount": 124.50,
  "Quantity": 1,
  "ProfileKey": "twfg$ae12deH8631552",
  "SessionKey": "jfAbyWef52319mDfa"
}
'

Add to wishlist

The addtowishlist event tracks cart additions.

Property

Type

Value / description

ProfileKey

Text

The profile key identifying the visitor.

SessionKey

Text

The sessionkey for the specific user. This can be your own sessionkey, GA session. As long as it's consistent over the users' session. Allowed characters: alphanumeric and hyphens (hts Tag is j)

ProductKey

Text

The unique id of the item known at Tweakwise

curl --request POST \
     --url https://navigator-analytics.tweakwise.com/api/addtowishlist \
     --header 'Instance-Key: INSTANCEKEY' \
     --header 'content-type: text/json' \
     --data '
{
  "ProductKey": "3129",
  "ProfileKey": "twfg$ae12deH8631552",
  "SessionKey": "jfAbyWef52319mDfa"
}
'

Impression (coming soon)

To support Click Through Rates in our reporting, requests done to Tweakwise need the impression signal. The signal should be sent, everytime one of the following requests are done:

  • Navigation
  • Search
  • Recommendations
  • Guided Selling

Important: in case of a cached page the impression should still be pushed!

Property

Type

Value / description

RequestId

Text

The identifier of the linked Tweakwise request (see requestId)

SessionKey

Text

The sessionkey for the specific user. This can be your own sessionkey, GA session. As long as it's consistent over the users' session. Allowed characters: alphanumeric and hyphens (hts Tag is j)

curl --request POST \
     --url https://navigator-analytics.tweakwise.com/api/pageimpression \
     --header 'Instance-Key: INSTANCEKEY' \
     --header 'content-type: text/json' \
     --data '
{
  "RequestId": "d03c40f5-6894-4e4f-9cd8-95d4efe38eaa",
  "SessionKey": "jfAbyWef52319mDfa"
}
'