Skip to main content

Custom Sales data API

Send your sales data directly to a endpoint

Written by Sarah Fogtmand

PriceShape provides an open API that allows you to send sales and performance data directly from your shop or another system to PriceShape.

By sending data such as page views, products added to cart, and sales, you can bring your sales performance together with your product and pricing data in PriceShape. This gives you greater insight into how your products are performing and how pricing may relate to their performance.

The sales data can be used to track metrics such as conversion rate, revenue, and sales performance, and can also be used when analyzing products or setting up price strategies based on product performance.


Ways to send sales data with a custom integration

If you want to build and manage the integration yourself, PriceShape provides two custom options:

  • Sales Data API: Send sales and performance data directly from your own system to PriceShape through our API.

  • PriceShape Sales Data Script: Add PriceShape's script to your webshop to collect and send sales data.

The API is a good option if you want to control the integration yourself or already collect the required data in your own systems.


What data can be sent?

The following events can be sent to PriceShape for each product:

  • Page viewed (pageViews): The number of times the product page has been viewed.

  • Product added to cart (itemAddedToCart): The number of times the product has been added to a cart.

  • Items sold (itemsSold): The total quantity of units sold.

  • Unique product sales (uniqueSales): The number of individual sales/orders containing the product.

For example, if one order contains 3 units of the same product, this would normally represent:

  • itemsSold: 3

  • uniqueSales: 1

Each sales data attribute is optional, so you only need to send the data that is available in your setup.


Before setting up the integration

Make sure that the product identifier included in your API requests corresponds to the products imported into your PriceShape account.

Using a consistent product identifier is important so PriceShape can connect the incoming sales data to the correct product.


How to find your integration token

To connect your integration, you need a token from your PriceShape account.

  1. Go to Account Settings → Integrations.

  2. Click Create Integration.

  3. Use the generated token when authenticating your API requests.

Keep your integration token secure and avoid exposing it publicly or in client-side code.


API endpoint

Send your sales data to:


Sending data in batches

The API supports bulk uploads, so you can send data for multiple products in the same request.

Any batch size is supported, but we recommend collecting your data and sending it in hourly batches rather than sending a request every time an individual event occurs.

This reduces the number of API requests while still keeping your sales data regularly updated in PriceShape.


Data format requirements

When sending data to the API, pay particular attention to the format of numeric values.

The following fields must be sent as numbers and not strings:

  • pageViews

  • itemAddedToCart

  • uniqueSales

  • itemsSold

For example:

Correct:

"itemsSold": 4

Incorrect:

"itemsSold": "4"

If numeric values are sent as strings, the data may not be processed correctly.

Each attribute is optional, so an attribute can be left out if you do not have data for that metric.


Example in PHP:

<?php
$client = new Client();
$headers = [
'Authorization' => 'Bearer INSERT_TOKEN_HERE',
'Content-Type' => 'application/json'
];
$body = '[
{
"upi": "6411501142214",
"timestamp": "2023-04-10T02:12:00Z",
"pageViews": 2,
"itemAddedToCart": 1,
"uniqueSales": 1,
"itemsSold": 4
}
]';
$request = new Request('POST','https://public.app.priceshape.io/api/2022-08/sales-data', $headers, $body);
$res = $client->sendAsync($request)->wait();
Did this answer your question?