Skip to main content
All CollectionsINTEGRATIONPLUG-IN INTEGRATIONS
Instruction for integration with Shoptet platform
Instruction for integration with Shoptet platform
Wioleta Jednaka avatar
Written by Wioleta Jednaka
Updated over 2 years ago

Integrating edrone with the Shoptet platform requires implementing a product feed. Prepare it and submit it to your onboarding supervisor for upload to our system.

Log in to the administration panel and from the menu on the left select "Appearance and Content" and then go to the "Editor" section.

Open the HTML editor tab and paste the following codes into the Header, Footer, and Order sections respectively.

If you do not see the HTML editor tab, please contact the Shoptet platform support.

Header

<script type="text/javascript">
(function (srcjs) {
window._edrone = window._edrone || {};
_edrone.app_id = 'YOUR_APP_ID';
_edrone.version = '1.0.0';
_edrone.platform_version = '1.0.0';
_edrone.platform = 'shoptet';
var doc = document.createElement('script');
doc.type = 'text/javascript';
doc.async = true;
doc.src = ('https:' == document.location.protocol ? 'https:' : 'http:') + srcjs;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(doc, s);
})("//d3bo67muzbfgtl.cloudfront.net/edrone_2_0.js");
</script>

The above script needs to be completed with the app_id, which you can find in the Integration section of edrone's settings

Footer

<script type="text/javascript">
const edroneCategories = (string, spliter) => {
if (string.indexOf(spliter) > -1) {
let temp = string.split(spliter);
return temp.join("~");
} else {
return string;
}
};
if (dataLayer[0].shoptet.pageType == "productDetail") {
var data = {
product_id: dataLayer[0].shoptet.product.id,
product_titles: dataLayer[0].shoptet.product.name,
product_image: document.querySelector('meta[itemprop="image"]').content,
product_url: document.querySelector('.p-detail meta[itemprop="url"]')
.content,
product_category: edroneCategories(
dataLayer[0].shoptet.product.currentCategory,
"|"
),
};

window._edrone = window._edrone || {};
_edrone.product_ids = data.product_id;
_edrone.product_titles = data.product_titles; // use url_encode
_edrone.product_images = data.product_image;
_edrone.product_urls = data.product_url;
_edrone.product_category_names = data.product_category;
_edrone.action_type = "product_view";

let addToCartButton = document.querySelector(
'form[action="/action/Cart/addCartItem/"] button'
);
if (addToCartButton) {
addToCartButton.addEventListener("click", () => {
_edrone.action_type = "add_to_cart";
_edrone.init();
});
}
}
if (dataLayer[0].shoptet.pageType == "customerDetails") {
const submitOrderButton = document.querySelector("#submit-order");
if (submitOrderButton) {
submitOrderButton.addEventListener("click", () => {
const name = document.querySelector("#billFullName").value.split(" ");
const customerData = {
first_name: name[0],
last_name: name[1],
email: document.querySelector("#email").value
};
localStorage.setItem("customerData", JSON.stringify(customerData));
});
}
}
</script>

Order

<script type="text/javascript">
const getOrderData = () => {
const items = dataLayer[0].shoptet.order.content;
let itemsName = "";
let itemsID = "";
let itemsCounts = "";
items.forEach((element, index) => {
if (index == items.length - 1) {
itemsName += element.name;
itemsID += element.id;
itemsCounts += element.quantity.toString();
} else {
itemsName += element.name + "|";
itemsID += element.id
itemsCounts += element.quantity.toString() + "|";
}
});
return {
names: itemsName,
ids: itemsID,
counts: itemsCounts,
order_value: dataLayer[0].shoptet.order.total,
order_id: dataLayer[0].shoptet.order.orderNo,
country: dataLayer[0].shoptet.order.country,
city: dataLayer[0].shoptet.order.city,
currency: dataLayer[0].shoptet.order.currencyCode
};
};
const orderData = getOrderData();
const customerData = JSON.parse(localStorage.getItem('customerData'));
window._edrone = window._edrone || {};
_edrone.action_type = "order";
_edrone.email = customerData.email;
_edrone.first_name = customerData.first_name;
_edrone.last_name = customerData.last_name;
_edrone.product_ids = orderData.ids
_edrone.product_titles = orderData.names
_edrone.product_counts = orderData.counts
_edrone.order_id = orderData.order_id
_edrone.country = orderData.country;
_edrone.city = orderData.city
_edrone.base_currency = orderData.currency;
_edrone.order_currency = orderData.currency;
_edrone.base_payment_value = orderData.order_value
_edrone.order_payment_value = orderData.order_value
localStorage.removeItem('customerData');
</script>

After pasting the above codes, save the changes.

Did this answer your question?