GLAMI TOP integration guide for developers

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:

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

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.

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.

C) Integration with Javascript (programmer needed)

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.cz/js/compiled/or.js', 'glami_or');

glami_or('addParameter', 'merchant_id','your_GLAMI_TOP_API_Key', 'cz');
glami_or('addParameter', 'order_id', 'ORDER_1');
glami_or('addParameter', 'email', 'name@domain.cz');
glami_or('addParameter', 'language', 'cs');
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 bold with dynamic values specific to your site and the order. Your GLAMI TOP API Key can be found in your Admin Panel in Settings > Shop Settings > API Keys.

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.cz.
language Language string (2), string (5) The language code 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.cz/js/compiled/or.js', 'glami_or');

glami_or('addParameter', 'merchant_id','your_GLAMI_TOP_API_Key', 'cz');
glami_or('addParameter', 'order_id', 'X95624');
glami_or('addParameter', 'email', 'john@doe.cz');
glami_or('addParameter', 'language', 'cs');
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.cz');
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.cz');
The `language` parameter is formatted incorrectly. Store has sent incorrect country code, it must be one of the 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');
or
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 Review survey's from our email servers, and as the sender we list the email of your e-shop, which you set up in your partner administration.

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

  1. Let us know on support@glami.cz the email address which we will send emails with the surveys to customers from. 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.

Once you set it up, please let us know on support@glami.cz and we will let you know whether the records were setup correctly.