Backend purchase (EN)

The purchase event should be sent to the API endpoint of Squeezely when a purchase is confirmed in the order system. It is also recommended to trigger the purchase from the frontend as well.

When using Copernica, the backend purchase can be received through the link of:

https://squeezely.atlassian.net/wiki/spaces/SG/pages/2618163236

Because of the following situations, both frontend and backend purchase are recommended:

  • The frontend purchase is not always triggered because the thank you page is not loaded

  • Because of some Adblockers the cookies are not accepted and therefore no frontend events are sent to Squeezely

In the example below the advantage of sending both is shown:

Frontend purchase only

Frontend & Backend purchase

Frontend purchase only

Frontend & Backend purchase

  1. Profile A does a purchase

  2. Profile A clicks away the thank you page before it is loaded = no frontend purchase, so no purchase

  1. Profile B will make a purchase

  2. Profile B clicks away the thank you page before it loads = no frontend purchase

  3. Information from the order system that Profile B has made a purchase = backend purchase



Content

In the backend purchase event, the following fields will be sent as a minimum:

Field label

Field content

Field label

Field content

event

Purchase

email

Email address of the profile

orderid

Id of the order

products

id

Id of the purchased product

quantity

Number of the purchased product

Note: the product id in the event should match the SKU of the product in Squeezely!

In the following circumstances more fields are required:

  1. Are multiple languages used? → Then also send language into the product array

  2. Are multiple currencies used? → add currency to the event

Extra

In this event extra data fields from the database can be sent. Maybe there are fields added to the event in the Data Plan, which are needed to set up use cases

An overview of the data fields you can send in the event, can be found here: https://squeezely.atlassian.net/wiki/spaces/SG/pages/2620489729



First you need to create the custom data fields in Squeezely https://squeezely.atlassian.net/wiki/spaces/SG/pages/2620522500

Next you can send these with the field label: custom_(name of the field).

For example, in the case of the custom data field custom_province, custom_province must be sent along.

Implementation

The documentation for implementing the Backend Purchase via API Calls, can be found here: https://squeezely.tech/documentation#backend-purchase

Check

After the implementation you can check the following two things

  • The response to the API call

  • The event in Squeezely

The following response to the API call is correct:

The following response is incorrect:

You can check the event in Squeezely as follows:

  • Go to: https: //squeezely.tech/data/audience/new

  • Click on custom

  • Set the following rules:

    • Events = purchase

    • Name = Test backend purchase

    • Retention = 1

  • Save the audience and wait until the status is 'Live

  • Go to Audiences

  • Click on 'Inspect

  • Click on an event ID

  • Check the following fields in the event:

    • Created at: is this a time after the implementation of the API Call? If not select another event ID.

    • Api inserted & api verified: does one of these fields contain 'yes'? Then the event has been implemented correctly. If not, check the implementation.

Please note that the frontend and backend purchase are merged based on the order id. When you only send a backend purchase the consent fields are not visible in the event. A change of consent can be checked in the profile of the event.

More information about the backend purchase can be found here: https://squeezely.tech/documentation#backend-purchase