Purchase

This event marks purchasing a set of items

To the API-reference

How to implement?

<!-- INSTANCE_KEY SESSION_KEY AND PROFILE_KEY are inherited from the base tag -->
<script>
  tweakwiseLayer.push({
  	event: 'purchase',
  	data: {
	  	productKeys: ['ARTICLE_NUMBER_1', 'ARTICLE_NUMBER_2', 'ARTICLE_NUMBER_3'],
      revenue: REVENUE
  	}
});
</script>
curl --request POST \
     --url 'https://navigator-analytics.tweakwise.com/api/addtowishlist?instanceKey=INSTANCE_KEY' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "ProfileKey": "PROFILE_KEY",
  "SessionKey": "SESSION_KEY",
  "ProductKey": "ITEM_ID"
}
'

Parameters

NameTypeRequiredDescription
INSTANCE_KEYURL-parameter - textyesYour Tweakwise Instance Key
PROFILE_KEYBody parameter - textyesThe ID that identifies the current visitor. Read more about the profile key here
SESSION_KEYBody parameter - textyesThe session key for the specific user. This can be your own session key or GA session. As long as it's consistent over the user's session.
Allowed characters: alphanumeric and hyphens
ARTICLE_NUMBER_*Body parameter - textyesThe Tweakwise item ID of the product that has been purchased
REVENUEBody parameter - decimalyesThe total amount of the products (item price x quantity)

When do I submit this event?

Submit this event when a visitor has purchased one or more items.

Where do I implement this event in the code?

On the 'Thank You' page of your shop that is shown after a purchase.

How to handle event-specific warnings from Tweakwise

⚠️No Purchases received in the last 4 days

Description

No Purchases events have been received in the last 4 days.

Possible solution

Verify that the conversion tracking script on the thank you/success page is working correctly and triggering upon completed orders.

⚠️SessionKey: xx% missing / ProfileKey: xx% missing / ProductKeys: xx% missing / Revenue: xx% missing

Description

More than 0.5% of the Purchases events are missing one of the required fields (SessionKey, ProfileKey, ProductKeys, or Revenue).

Possible solution

Review the checkout integration and ensure all required order and product parameters are properly structured in the event payload.

⚠️ProductKeys: xx% not found

Description

More than 7% of the purchased products contain ProductKeys that are not present in the Tweakwise catalog.

Possible solution

Check whether variant IDs or main product IDs at checkout correspond with the ID format used in the Tweakwise feed/import.

⚠️xx% of purchases are duplicates

Description

Duplicate Purchases events have been detected.

Possible solution

Prevent the Purchase event from firing again when refreshing the thank you page. Implement a check against a unique transaction or order ID to avoid duplicate registration.

Please share your findings with your implementation partner. If they have questions about these messages, please have them contact [email protected].