Skip to content

Review popup

Normally users share completed order data with WebwinkelKeur after which we send the customers an email requesting them to review the shop.

We have developed a "Privacy First" review process especially for the German market. In this process, no data is passed on unless the customer has given their prior consent.

After a customer completes the check-out, a pop-up will appear on your site: Thank you page pop-up.

The customer can write a review directly or select the "Ask me later" option. In both cases, consent to the transfer of data to WebwinkelKeur is obtained.

When the order is completed, the order data is passed on to WebwinkelKeur. We link this to the submitted rating or send an invitation to review your shop. Both lead to a published review by a "verified customer".

To activate this process you will need to implement all of these 3 steps:

  1. Insert the sidebar script
    This is the basic integration of WebwinkelKeur with your shop.

  2. Insert order data script
    When the script element is detected, the sidebar will load the review pop-up.

  3. Check for consent and add invitation
    Share the order data with WebwinkelKeur after the consent is given and the order is completed. Which results in a published review by a "verified customer".

1. Insert the sidebar script

By including our sidebar script into your web shop you are not only able to show your trust seals, ratings and include banners and tooltips, but also include our review pop-up where your customers are able to review your shop directly after their order and/or get his/her permission for a (final) review.

Example:

<script>
    (function (n, r) {
        var e = document.createElement("script");
        e.async = !0, e.src = n + "/sidebar.js?id=" + r + "&c=" + c(10, r);
        var t = document.getElementsByTagName("script")[0];
        t.parentNode.insertBefore(e, t);

        function c(s, i) {
            var o = Date.now(), a = s * 6e4, _ = (Math.sin(i) || 0) * a;
            return Math.floor((o + _) / a)
        }
    })("https://dashboard.webwinkelkeur.nl", <webshop's ID>);
</script>

You can find preconfigured code in your Dashboard

For more information about the sidebar - Sidebar docs

2. Insert order data script

WebwinkelKeur sidebar searches for a script with id ="webwinkelkeur_order_completed". When the script element is detected, the sidebar will load the pop-up.

You have to dynamically retrieve the orderNumber, email, firstName and place them inside the script. Place the script on the order finish page (Thank you page).

Example:

<script type="application/json" id="webwinkelkeur_order_completed">
{
    "webshopId": 123, // required - can be found in WebwinkelKeur dashboard
    "orderNumber": "order123", // required
    "email": "customerEmail@example.com", // optional
    "firstName": "Customer", // optional
    "inviteDelay": 1 // optional - default value 5
}
</script>

The sidebar will detect the order data script and display the Thank you page review pop-up.

Review pop-up does not create an invitation email. You have to call the [Add invitation][inv] endpoint for that (Step 3).

Thi step is handled in the backend of your shop system.

You should use this endpoint to determine if an invitation should be created or not - [Add invitation][inv].

Before creating an invitation, call this endpoint to check if a consent has been given for the orderNumber.

GET /2.0/order_permissions.json

Query parameters

They should be passed as query parameters to the URL. (ex.: ?id=1&code=abc)

id int (required)

The unique webshop ID.

code string (required)

Your personal API code.

orderNumber string (required)

The order to check

Example response

{
    "has_consent": true
}

When an order has reached the desired status (usually "shipped" or "completed") and you've checked that consent has been given for this order, the [Add invitation][inv] endpoint should be called.

This will share the order data with the WebwinkelKeur system.

If a review has been written it will be marked as a verified review and the customer will receive an edit email after the set delay.

Customer that choose to ask me later will receive a review invite after the set delay.

Example code:

<?php

// this code should be triggered by the switch of an order status
// usually after the order has been shipped or delivered

$baseUrl = 'https://dashboard.webwinkelkeur.nl/api';
$endpointOrderPermission = '/2.0/order_permissions.json';
$endpointAddInvitation = '/1.0/invitations.json';

// your API credentials can be found in the WebwinkelKeur dashboard:
// https://dashboard.webwinkelkeur.nl/app/api

$id = 'xxxxxxx';
$api_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';

// the order number of the order that you want to send the invitation for
$orderNumber = 'order777';

// Initialize cURL
$curl = curl_init(
    sprintf(
        '%s%s?id=%s&code=%s&orderNumber=%s',
        $baseUrl,
        $endpointOrderPermission,
        $id,
        $api_key,
        $orderNumber,
    ),
);

// set options and execute
curl_setopt_array($curl, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTPGET => true,
]);
$response = curl_exec($curl);

// close cURL resource
curl_close($curl);

// check if the request was successful
if (!$response) {
    // An error occurred
    return;
}
$data = json_decode($response, true);

// pretty print json
echo '<pre>' . json_encode($data, JSON_PRETTY_PRINT) . '</pre>';

if ($data['has_consent'] === false) {
    // permission was not granted
    return;
}

// the order permission was granted, now we can add the invitation to the queue

// prepare post object for the invitation
$post = [
    'email' => 'johndoe@gmail.com', // required
    'order' => $orderNumber, // required
    'language' => 'en',
    'delay' => 0,
    'customer_name' => 'John Doe',
    'phone_numbers' => ['+31612345678'],
    'order_total' => 1500.99,
    'order_data' => json_encode([
        'products' => [
            [
                'id' => '1234',
                'name' => 'Product 1',
                'url' => 'https://example.com/products/1',
                'image_url' => 'https://example.com/products/images/1',
                'sku' => 'PROD1234',
                'gtin' => '12345678s',
            ],
        ],
    ]),
];

// Initialize cURL
$curl = curl_init(
    sprintf(
        '%s%s?id=%s&code=%s',
        $baseUrl,
        $endpointAddInvitation,
        $id,
        $api_key,
    ),
);

// set options and execute
curl_setopt_array($curl, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => http_build_query($post),
]);
$response = curl_exec($curl);

// close cURL resource
curl_close($curl);

if (!$response) {
    // An error occurred
    return;
}

$data = json_decode($response, true);

if ($data['status'] === 'success') {
    // the invitation was successfully added to the queue
} else {
    // An error occurred
}