Instructions for the manual integration of the uptain snippet
The following instructions show you how you can manually integrate uptain into your shop. The specified steps primarily serve as an orientation and description of functionalities, since the exact implementation depends on your system.
Please note that we recommend integrating one of our plugins if possible.
If you have any further questions, please write an email to support@uptain.de.
If you do not yet have an account with uptain, you can register here: Create account
This a complete overview of data that can be submitted. All field marked in red are mandatory.
Embed a JavaScript-Snippet on all pages
The following JavaScript-Snippet should be loaded on every page (preferably asynchronously, potentially a little delayed and at the end of the body).
<script type="text/javascript" src="https://app.uptain.de/js/uptain.js?x=XXXXXXXXXXXXXXXX" async></script>
The "XXXXXXXXXXXXXXXX" is the uptain-ID that will be provided by uptain and needs to be filled by each plugin user. For testing purposes you may obtain your own uptain-ID by registering with uptain: Register
Provide additional information in a HTML tag
When the JavaScript-Snippet is executed (with every page load) it will check for provided information in the HTML tag with the ID "__up_data_qp" in the DOM. This HTML tag cannot be loaded later than the JavaScript-Snippet. However, the JavaScript-Snippet may contain the information itself.
The resulting combined JavaScript-Snippet may for instance look like this:
<script id="__up_data_qp" src="https://app.uptain.de/js/uptain.js?x=XXXXXXXXXXXXXXXX" async></script>
Or it might be two separate HTML tags:
<script src="https://app.uptain.de/js/uptain.js?x=XXXXXXXXXXXXXXXX" async></script>
<div id="__up_data_qp" style="display: none;"></div>
Include non-personal data
Additional data should be included in the HTML tag. The following tables define in detail which information should be included on which pages. For instance, the plugin version is always available and should thus be always included. Whereas, a success=1 should only be included once the order was completed (e.g. on the success or thank you page).
The following data depicted by table A should be included all the time:
Table A:
Name | Content |
returnurl | Unencoded URL that leads directly to the filled shopping cart. |
page | On of the following strings: "home", "checkout", "cart", "product", "category", "success", "other", "search" |
wishlist | JSON for all products on the wish list containing for every product-id the amount of that product as well as the name and potential variants. |
comparison | JSON for all products on comparison containing for every product-id the amount of that product as well as the name and potential variants. |
The resulting JavaScript snippet may for instance look like this:
<script id="__up_data_qp" src="https://app.uptain.de/js/uptain.js?x=XXXXXXXXXXXXXXXX"
data-returnurl="https://www.uptain.de?cartid=123456789"
data-page="cart"
data-wishlist="{'id1':{amount:10,name:'Levis Jeans',variants: {color:'blue',size:'XL'}},'id2':{amount:1,name:'Nike Sports Shoes',variants: {size:'45'}}}"
data-comparison="{'id1':{amount:10,name:'Levis Jeans',variants: {color:'blue',size:'XL'}},'id2':{amount:1,name:'Nike Sports Shoes',variants: {size:'45'}}}"
async></script>
The following data depicted by table B should be included whenever and as long as something is in the shopping cart:
Table B:
Name | Content |
scv | Current net sum of the shopping cart. Excluding taxes, delivery or payment costs. Decimal separator is "." and uses two decimals after the dot. No thousand separators. Make sure this value is “0” when the cart is empty. Make sure this value is not “0” on the thank-you- / order-confirmation-page |
currency | Currency code of the scv using the ISO-421 format (https://de.wikipedia.org/wiki/ISO_4217 ). |
tax-amount | Costs for the taxes (e.g. "13683.65"). Decimal separator is "." and uses two decimals after the dot. No thousand separators. No indicative negative sign. |
usedvoucher | Discount code that was applied to the shopping cart. |
voucher-amount | Applied discount to the shopping cart (e.g. "13683.65"). Decimal separator is "." and uses two decimals after the dot. No thousand separators. No indicative negative sign. |
voucher-type | Type of the discount as a string. Can be "percentage", "monetary" or "free-shipping" or "other". |
shipping | Selected delivery method as a string. |
payment | Selected payment method as a string. |
shipping-costs | Costs for the delivery (e.g. "13683.65"). Decimal separator is "." and uses two decimals after the dot. No thousand separators. No indicative negative sign. |
payment-costs | Costs for the delivery (e.g. "13683.65"). Decimal separator is "." and uses two decimals after the dot. No thousand separators. No indicative negative sign. |
postal-code | Postal code of the delivery and the accounting address. To be for instance transmitted as "delivery:20255;accounting:25421". |
products | JSON for all products in the shopping cart containing for every product-id the amount of that product as well as the name and potential variants. |
The resulting JavaScript snippet may for instance look like this:
<script id="__up_data_qp" src="https://app.uptain.de/js/uptain.js?x=XXXXXXXXXXXXXXXX"
data-returnurl="https://www.uptain.de?cartid=123456789"
data-page="cart"
data-wishlist="{'id1':{amount:10,name:'Levis Jeans',variants: {color:'blue',size:'XL'}},'id2':{amount:1,name:'Nike Sports Shoes',variants: {size:'45'}}}"
data-comparison="{'id1':{amount:10,name:'Levis Jeans',variants: {color:'blue',size:'XL'}},'id2':{amount:1,name:'Nike Sports Shoes',variants: {size:'45'}}}"
data-scv="38.89"
data-currency="EUR"
data-tax-amount="7.39"
data-usedvoucher="12345"
data-voucher-amount="5.00"
data-voucher-type="monetary"
data-shipping="DHL"
data-payment="PayPal"
data-shipping-costs="0.00"
data-payment-costs="0.00"
data-postal-code="delivery:20255;accounting:25421"
data-products="{'id1':{amount:10,name:'Levis Jeans',variants: {color:'blue',size:'XL'}},'id2':{amount:1,name:'Nike Sports Shoes',variants: {size:'45'}}}"
async></script>
The following data depicted by table C should be included on category pages:
Table C:
Name | Content |
category-name | The category name as a string. |
category-path | The full category path which is separated by semicolons (e.g. clothes;trousers). Not including the current category. |
category-products | JSON for all products shown on the category page containing for every product-id the name, the "product-id" and a number indicating the position of the product on the page (1 for the first product, 2 for the second etc.) |
category-sorting | The sorting selected by the user, e. g., "price-ascending", "alphabetical-descending", or "default" if the shop’s default applies (i. e., the user does not choose a sorting) |
The resulting JavaScript snippet may for instance look like this:
<script id="__up_data_qp" src="https://app.uptain.de/js/uptain.js?x=XXXXXXXXXXXXXXXX"
data-returnurl="https://www.uptain.de?cartid=123456789"
data-page="cart"
data-wishlist="{'id1':{amount:10,name:'Levis Jeans',variants: {color:'blue',size:'XL'}},'id2':{amount:1,name:'Nike Sports Shoes',variants: {size:'45'}}}"
data-comparison="{'id1':{amount:10,name:'Levis Jeans',variants: {color:'blue',size:'XL'}},'id2':{amount:1,name:'Nike Sports Shoes',variants: {size:'45'}}}"
data-category-name="Jeans"
data-category-path="Clothes;Trousers"
data-category-products="{'id1':{name:'Levis Jeans',position:1}, 'id2':{name:'Nike Sports Shoes',position:2}}"
data-category-sorting="price-ascending"
async></script>
The following data depicted by table D should be included on product pages:
Table D:
Name | Content |
product-id | A unique ID that identifies the product. |
product-name | The product name as a string. |
product-price | Price of the product. Decimal separator is "." and uses two decimals after the dot. No thousand separators. |
product-original-price | Original price of the product (not-on-sale-price). Decimal separator is "." and uses two decimals after the dot. No thousand separators. |
product-image | The URL of the product image. |
product-tags | If the item has structured features available, then supply them. For example, items in a shop system may be tagged with features such as "waterproof", "10 yr warranty", "outdoor". To be transmitted as "waterproof;10 yr warranty;outdoor" where the tags are strings. |
product-variants | The variants of a product (e.g. size or color). To be transmitted as "size:XL;color:blue" where the variant is a string. |
product-category | The category of the product as a string (e.g. "Jeans"). |
product-category-paths | All category paths containing for every category-path the detailed path which is separated by slashes. Multiple paths are separated by semicolons (e.g. "clothes/trousers/jeans;outdoor/pants"). |
The resulting JavaScript snippet may for instance look like this:
<script id="__up_data_qp" src="https://app.uptain.de/js/uptain.js?x=XXXXXXXXXXXXXXXX"
data-returnurl="https://www.uptain.de?cartid=123456789"
data-page="cart"
data-wishlist="{'id1':{amount:10,name:'Levis Jeans',variants: {color:'blue',size:'XL'}},'id2':{amount:1,name:'Nike Sports Shoes',variants: {size:'45'}}}"
data-comparison="{'id1':{amount:10,name:'Levis Jeans',variants: {color:'blue',size:'XL'}},'id2':{amount:1,name:'Nike Sports Shoes',variants: {size:'45'}}}"
data-product-id="id1"
data-product-name="Levis Jeans"
data-product-price="51.28"
data-product-original-price="99.99"
data-product-image="https://uptain.de/app/uploads/2021/04/logo_uptain.png"
data-product-tags="waterproof;10 yr warranty;outdoor"
data-product-variants="size:XL;color:blue"
data-product-category="Jeans"
data-product-category-paths="clothes/trousers/jeans;outdoor/pants"
async></script>
The following data depicted by table E should be included on search result pages:
Table E:
Name | Content |
search-term | The terms that were searched for as a string. |
search-products | JSON for all products shown on the search result page containing for every product-id the name, the "product-id" and a number indicating the position of the product on the page (1 for the first product, 2 for the second etc.) |
search-sorting | The sorting selected by the user, e. g., "price-ascending", "alphabetical-descending", or "default" if the shop’s default applies (i. e., the user does not choose a sorting) |
The resulting JavaScript snippet may for instance look like this:
<script id="__up_data_qp" src="https://app.uptain.de/js/uptain.js?x=XXXXXXXXXXXXXXXX"
data-returnurl="https://www.uptain.de?cartid=123456789"
data-page="cart"
data-wishlist="{'id1':{amount:10,name:'Levis Jeans',variants: {color:'blue',size:'XL'}},'id2':{amount:1,name:'Nike Sports Shoes',variants: {size:'45'}}}"
data-comparison="{'id1':{amount:10,name:'Levis Jeans',variants: {color:'blue',size:'XL'}},'id2':{amount:1,name:'Nike Sports Shoes',variants: {size:'45'}}}"
data-search-term="Outdoor pants woodworking"
data-search-products="{'id1':{name:'Levis Jeans',position:1}, 'id2':{name:'Nike Sports Shoes',position:2}}"
data-search-sorting="price-ascending"
async></script>
The following data depicted by table F should be included on success pages and whenever an order was placed. All information about the shopping cart (table B) should also be included here.
Table F:
Name | Content |
success | "1" once an order was completed, "0" or "" in all other cases. |
ordernumber | The order ID used by the shop system (and the shop management) to identify placed orders. |
The resulting JavaScript snippet may for instance look like this:
<script id="__up_data_qp" src="https://app.uptain.de/js/uptain.js?x=XXXXXXXXXXXXXXXX"
data-returnurl="https://www.uptain.de?cartid=123456789"
data-page="cart"
data-wishlist="{'id1':{amount:10,name:'Levis Jeans',variants: {color:'blue',size:'XL'}},'id2':{amount:1,name:'Nike Sports Shoes',variants: {size:'45'}}}"
data-comparison="{'id1':{amount:10,name:'Levis Jeans',variants: {color:'blue',size:'XL'}},'id2':{amount:1,name:'Nike Sports Shoes',variants: {size:'45'}}}"
data-success="1"
data-ordernumber="PO16328934"
async></script>
Include personal data depending on plugin settings
Additionally, personal data should be included into the HTML tag depending on the plugin settings (see below). As soon as and as long as the data is available (and the plugin settings indicate it should be transmitted) it should be included in the HTML tag on every page.
The following personal data depicted by table G should be included if plugin settings indicate it on every page:
Table G:
Name | Content |
Unencoded email address of the shop’s customer. | |
firstname | First name of the shop’s customer. Leave empty ("") if unknown. |
lastname | Last name of the shop’s customer. Leave empty ("") if unknown. |
gender | Gender of the shop’s customer. Use "f" for females and "m" for males. Leave empty ("") if diverse or unknown. |
title | Title of the shop’s customer (e.g. "Dr."). Leave empty ("") if unknown. |
uid | Unique ID to identify the customer even if they change their personal data. |
revenue | The sum of all net orders of the shop’s customer. Excluding taxes, delivery or payment costs and returned orders. Decimal separator is "." and uses two decimals after the dot. No thousand separators. |
customergroup | Customer group of the shop’s customer as a string. |
The resulting JavaScript snippet may for instance look like this:
<script id="__up_data_qp" src="https://app.uptain.de/js/uptain.js?x=XXXXXXXXXXXXXXXX"
data-returnurl="https://www.uptain.de?cartid=123456789"
data-page="cart"
data-wishlist="{'id1':{amount:10,name:'Levis Jeans',variants: {color:'blue',size:'XL'}},'id2':{amount:1,name:'Nike Sports Shoes',variants: {size:'45'}}}"
data-comparison="{'id1':{amount:10,name:'Levis Jeans',variants: {color:'blue',size:'XL'}},'id2':{amount:1,name:'Nike Sports Shoes',variants: {size:'45'}}}"
data-firstname="Jane"
data-lastname="Doe"
data-gender="f"
data-title="Dr."
data-uid="c81e728d9d4c2067f89cc14862c"
data-revenue="4800.21"
data-customergroup="general"
async></script>
Updating data
With every page load the embedded JavaScript-Snippet executes and transmits all data provided in the HTML tag (see 2). However, some data needs to be transmitted to uptain without a new page load while the user remains on the same page. For instance, if something was put into the shopping cart and the page is not reloaded or the products on a category or a search result page are loaded asynchronously.
After the updated data was written into the HTML tag, a JavaScript function needs to be executed to initiate the transmission of data to uptain. In this case, the following function should be executed:
window._upEventBus.publish("uptain.readData");
Please always remember to test the functionalities yourself, as far as you can.