GLAMI TOP integration guide

GLAMI TOP is a service that helps your eshop get customer feedback on your services and the quality of the products they have purchased from you.

Here's how to implement GLAMI TOP:

  • Implement the collection of consent with the service in one of the following ways:
    • Your shop-system supports GLAMI TOP
    • Integration with Google Tag Manager
    • Integration with Javascript
  • Setup the sending of the emails with surveys, so they do not fall into spam.

1. Implementing the consent collection

Setting up consent collection allows us to find out whether customers want to participate in the GLAMI TOP program and allows you to send GLAMI all necessary transaction information.

Integration instructions

The collection of consent in the form of a pop-up should be collected on the last page of the ordering process - on the payment confirmation page for immediate payment by card or other method, or on the order confirmation page for bank transfer or cash on delivery.

All confirmation pages must use HTTPS.

Since this module triggers the opt-in survey, all the order data in this module must be accurate and correct. Do not cover the opt-in survey with any other content on the order confirmation page.

A) Your shop-system supports GLAMI TOP (no programmer needed)

If your shop-system already supports GLAMI TOP, the integration will be very simple. You can set up the consent collection (point 1) directly in the administration of your shop system. Go to the administration of your shop-system and look for the module for GLAMI TOP. Follow the instructions.

Setup sending of all parameters - all are mandatory. Examples of parameters with explanation can be found in the table below.

You can check whether your shop-system supports this function in the How to connect your store to GLAMI section or directly with the shop-system.

After the implementation of the module, it is still necessary to set DNS records (point 2 of this integration guide), for more information see below.

B) Integration with Google Tag Manager (programmer needed)

If you use Google Tag Manager, you can speed up the setup of data collection using a template in the GTM Gallery.

Proceed as in C) Integration with Javascript. Set the sending of all parameters - all are mandatory. Examples of parameters with explanation can be found in the table below.

After the implementation of the module, it is still necessary to set DNS records (point 2 of this integration guide), for more information see below.

Link to GTM template https://tagmanager.google.com/gallery/#/owners/glami/templates/top-gtm-template.

C) Integration with Javascript (programmer needed)

Adding the opt-in code

Paste the following HTML snippet into the order confirmation page:

<script>
(function (f, a, s, h, i, o, n) {
f['GlamiOrderReview'] = i;
f[i] = f[i] || function () {(f[i].q = f[i].q || []).push(arguments);};
o = a.createElement(s), n = a.getElementsByTagName(s)[0];
o.async = 1; o.src = h; n.parentNode.insertBefore(o, n);
})(window,document,'script','//www.glami.de/js/compiled/or.js', 'glami_or');

glami_or('addParameter', 'merchant_id','FFFFDDDDFFFFDDDDFFFFDDDDFFFFDDD', 'de');
glami_or('addParameter', 'order_id', 'ORDER_1');
glami_or('addParameter', 'email', 'name@domain.de');
glami_or('addParameter', 'language', 'de');
glami_or('addParameter', 'items', [
    {
        id: 36463570,
        name: 'Long laces, red'
    },
    {
        id: 'XT-27927237',
        name: 'T-shirt with moose pattern'
    }
]);

glami_or('create');
</script>

Place the code just before the ending html element </BODY>.

Replace the values in red with dynamic values specific to your site and the order.

All parameters are required.

The following table describes the available settings:

Variable Name Data type Purpose and description
merchant_id E-shop ID string (32) Eshop ID. The second parameter is used to determine the GLAMI domain, on which your eshop is registered (cz for Glami.cz, de for Glami.de, tr for Glami.com.tr). You can find the correct values in your GLAMI partner administration.
order_id Order ID string (32) Unique order ID. Used to identify individual orders.
email Customer email string (255) Email address in the format name@domain.de.
language Language string (2), string (5) Language code that determines which language GLAMI will use to communicate with the customer.
Valid formats are ISO 639-1 (cs, de, fr, sk, ro, hu, bg, el, tr, hr, sl, en, pt, es, et, lt, lv, it, pl) or locale string (cs_CZ, de_DE, fr_FR, sk_SK, ro_RO, hu_HU, bg_BG, el_GR, tr_TR, hr_HR, sl_SI, en_US, pt_BR, es_ES, et_EE, lt_LT, lv_LV, it_IT, pl_PL).
items Items array List of purchased items
Array of json objects describing purchased items. Every object must contain these properties:
id
ID of the item that is contained in the store's product feed. May include sold out products - string|integer
name
Name of item that will be displayed in the email - string
Opt-in code example

Variable values are usually replaced on the order confirmation page with the code on the server-side. The following example shows how to implement opt-in code with PHP:

<script>
(function (f, a, s, h, i, o, n) {
f['GlamiOrderReview'] = i;
f[i] = f[i] || function () {(f[i].q = f[i].q || []).push(arguments);};
o = a.createElement(s), n = a.getElementsByTagName(s)[0];
o.async = 1; o.src = h; n.parentNode.insertBefore(o, n);
})(window,document,'script','//www.glami.de/js/compiled/or.js', 'glami_or');

glami_or('addParameter', 'merchant_id','FFFFDDDDFFFFDDDDFFFFDDDDFFFFDDD', 'de');
glami_or('addParameter', 'order_id', 'X95624');
glami_or('addParameter', 'email', 'john@doe.de');
glami_or('addParameter', 'language', 'de');
glami_or('addParameter', 'items', [
    {
        id: 36463570,
        name: 'long laces, red'
    },
    {
        id: 'MD-27927237',
        name: 'Blue T-shirt'
    }
]);

glami_or('create');
</script>

Troubleshooting

This section describes some common errors you might encounter when implementing opt-in code.

Possible errors Solution Error example Solution example
The `email` parameter is formatted incorrectly. The email must be sent in the correct format. glami_or('addParameter', 'email', 'john @ down'); glami_or('addParameter', 'email', 'john@down.de');
The `email` parameter is out of range. Email is too long (max 255 characters).
The email must be sent in the correct format.
glami_or('addParameter', 'email', 'TooLongEmail .....'); glami_or('addParameter', 'email', 'john@down.de');
The `language` parameter is formatted incorrectly. Store sent incorrect country code. Must be one of ISO 639-1 language codes or locale string.
Valid formats are ISO 639-1 language code (cs, de, fr, sk, ro, hu, bg, el, tr, hr, sl, en, pt, es, et, lt, lv, it, pl) or locale string (cs_CZ, de_DE, fr_FR, sk_SK, ro_RO, hu_HU, bg_BG, el_GR, tr_TR, hr_HR, sl_SI, en_US, pt_BR, es_ES, et_EE, lt_LT, lv_LV, it_IT, pl_PL).
glami_or('addParameter', 'language', 'english'); glami_or('addParameter', 'language', 'en');
oder
glami_or('addParameter', 'language', 'en_US');
The `merchant_id` parameter is not valid. The store sent us an invalid Merchant ID. glami_or('addParameter', 'merchant_id', 'xldk89n'); glami_or('addParameter', 'merchant_id', 'FFFF797D13193B02F67CACBD50ED9999');
Array key `0` is not an JSON object We received parameter items in wrong structure.
We need array of JSON objects containing keys `id` and `name`
glami_or('addParameter', 'items', ["item 1", "item 2"]); glami_or( 'addParameter', 'items', [ {"id": 1, "name": "item 1"}, {"id": 2, "name": "item 2"} ] );
`items` must be array of JSON objects We need array of JSON objects containing keys `id` and `name` glami_or('addParameter', 'items', null); glami_or( 'addParameter', 'items', [ {"id": 1, "name": "item 1"}, {"id": 2, "name": "item 2"} ] );
JSON object does not contain valid `id` property key `id` in `items` parameter is either missing or empty glami_or('addParameter', 'items', [{"name": "item 1"}, {"name": "item 2"}]); glami_or( 'addParameter', 'items', [ {"id": 1, "name": "item 1"}, {"id": 2, "name": "item 2"} ] );
JSON object does not contain valid `name` property We need array of JSON objects containing keys `id` and `name` glami_or('addParameter', 'items', null); glami_or( 'addParameter', 'items', [ {"id": 1, "name": "item 1"}, {"id": 2, "name": "item 2"} ] );
Errors of depreacated parameters
Possible errors Solution Error example Solution example
The item_ids parameter should be separated by semicolons. The store has not sent us any items or empty product identifiers. All other formats are valid and used as one product identifier.
For example, "36463570,27927237" is taken as one product identifier. A semicolon separates product identifiers "36463570; 27927237".
glami_or('addParameter', 'item_ids', '');
glami_or('addParameter', 'item_ids', 'a212 ;;; b123');
glami_or('addParameter', 'item_ids', 'a212');
glami_or('addParameter', 'item_ids', 'a212 ; b123');
The `item_names` parameter should be separated by semicolons. Same as above with `item_ids` only semicolon-separated values are valid. Any other delimiter will be considered as part of the product name and thus as a single product identifier. glami_or('addParameter', 'item_names', 'women sport shoes, red umbrela'); glami_or('addParameter', 'item_names', 'skirt ;; jacket ;;'); glami_or('addParameter', 'item_names', 'women sport shoes;red umbrela'); glami_or('addParameter', 'item_names', 'skirt ; jacket');
Different number of `item_ids` and `item_names`. The number of identifiers and product names sent must be the same. glami_or('addParameter', 'item_ids', 'AS-1234'); glami_or('addParameter', 'item_names', 'blue jeans; red jacket'); glami_or('addParameter', 'item_ids', 'AS-1234; AS-4444'); glami_or('addParameter', 'item_names', 'blue jeans; red jacket');

2. Sending of questionnaire

We send the GLAMI Reviews survey from our email servers and as the sender we list the email of your eshop, which you set in your partner administration.

In order to successfully set up the e-mail system, you need to do the following two steps:

  1. In the partner administration, in the tab Reviews -> Settings, enter the email from which we will send emails with the surveys to customers. This email should have the same domain as your e-shop. For example, www.shop.com should have the email reviews@shop.com
  2. Change the DNS domain settings of your e-shop (the same domain that you will use to send the emails from step 1.) as described below. This setting is important so that your emails will not end up in the customer’s SPAM folder.

DNS setup instructions:

To protect emails sent from your domain, add our entry to your SPF record: _emailing.glami.cz

Example: If you have an entry for your domain v=spf1 ip4:1.2.3.4 -all, then the modified version will be v=spf1 ip4:1.2.3.4 include:_emailing.glami.cz -all

All outgoing emails from GLAMI are signed by our DKIM key. Create for your domain a subdomain glami-review._domainkey with a DNS CNAME record pointing to partner-review._domainkey.glami.cz

Some hosting providers require a dot at the end of the record. Example: glami-review._domainkey.glami.cz.

You can check the correct email settings in the partner administration, in the Reviews -> Settings tab, where you will see the SPF and DKIM status marked as "Verified" if set correctly, and "Failed" in the event of an error.