# Integrate your e-commerce platform

edrone is a marketing tool aimed at e-commerce platforms to support online stores in sales processes. Its offer includes solutions for marketing automation, email marketing, and CRM (Customer Relationship Management), among others. The functioning of the tool is based on the integration of the e-commerce platform (where the online store is based) with edrone. Thanks to the integration, you can identify and monitor users, store data in cookies and cache files, display onsite elements (popups, recommendation frames, chat, social-proof widgets) and send product data based on user interactions.

# How integration works

The integration of the platform is based on the implementation of the following scripts:

  • Initialization code, which must be on each subpage of the store, e.g. in the head section of the HTML code
<script type="text/javascript">
   (function (srcjs) {
       window._edrone = window._edrone || {};
       _edrone.app_id = 'YOUR APP_ID';
       _edrone.platform = 'custom';
       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?app_id=YOUR_APP_ID");
</script>

  • Events that relate to particular places on the page (product page, category page, order page) and send information about products, and users. The data can be retrieved from the store or directly from the platform via API.

You should implement the integration on the front-end side of the website. Sending events on the backend will make it impossible to identify and monitor the customers. What is more, you will have a reduction in the available edrone functionalities, which are based on real-time data retrieved from events.

# Backend

It is possible to send data to our system using backend technologies. This can be particularly useful if you want to import historical orders or customer base directly from an e-commerce platform or other sales channel. The events you can additionally send on the backend are:

Also associated with the backend is subscription status synchronization, which allows you to update your newsletter subscription status from edrone to your platform. More information can be found here

# Consents

One of edrone's essential functions is to identify and monitor users, and data about them is stored in cookies and browser cache. If your platform has a dedicated widget through which users can consent to the processing of their data, then information about integration with the edrone system must also be included there.

# Available approaches

# Integration templates

# Online stores

The main goal for the integration is to send all available information used by edrone from the online store. To do this, you need to implement the events presented in the Events section, on the individual pages of the site.

# Multilingual stores

In case the store has several language versions and allows payment in multiple currencies, each of them must have a separate integration because the data is sent through the front-end frontend in different languages and with the wrong currency. This will result in unreliable information in reports and, emails with products in various languages and prices.

To differentiate between the language versions of the store, modify the initialization code so that the value of the app_id field changes depending on the language the user has selected.


<script type="text/javascript">
    var current_app_id = ''
    switch(lang){*
      case 'PL':
        current_app_id = 'POLISH APP_ID'
      case 'EN':
        current_app_id = 'ENGLISH APP_ID'
      case 'DE':
        current_app_id = 'GERMAN APP_ID'
    }
   (function (srcjs) {
       window._edrone = window._edrone || {};
       _edrone.app_id = current_app_id;
       _edrone.platform = 'custom';
       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?app_id=YOUR_APP_ID");
</script>

# Landing pages

Landing pages are very often used to build a subscriber base, and they do not necessarily have to be under the same domain.
To integrate them, you need to insert initial code, as well as plug the existing form on the landing page using the Subscribe event

# Unsubscribe the customer

One of the events- 'Subscribe' allow you to change the subscription status of a given user. It has a parameter 'subscribe_status', which takes the value 1- subscribed or 0- unsubscribed. To change a user's status to subscribe, we can send such an event using a script implemented on the frontend or backend side, while unsubscribing a user, i.e. changing the value to 0, can only be sent on the backend side


<?php
  function subscriptionChange(){
    $edroneData = 'version=' . '1.0.0' .
       '&app_id=' . 'YOUR APP ID' .
       '&email=' . 'email@example.pl' .
       '&subscriber_status=' . '0/1' .
       '&action_type=' . 'subscribe' .
       '&sender_type=' . 'server';
       return $edroneData;
    }

  function httpPost($url, $params) {
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_HEADER, false);
     curl_setopt($ch, CURLOPT_POST, TRUE);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
     $output = curl_exec($ch);
     curl_close($ch);
     return $output;
  }
  httpPost('https://api.edrone.me/trace', subscriptionChange());

# When feed is needed

Product feed allows us to update product information in real-time, and it is most often used in email marketing and recommendation frames, because of the up-to-date data on product availability, as well as its price. An additional advantage of using a product feed is the ability to add product categories that are not on the store page. This can be especially useful if you want to build cross-selling or upselling campaigns.

# Google Tag Manager

GTM (Google Tag Manager) is a free tool that allows us to manage scripts by easily adding code snippets to a website or application.

Installing Google Tag Manager is quick and easy. Go to tagmanager website (opens new window) and create a new account and container.

# Events

# Homepage View

Purpose: Send information, about the view of homepage.

<script type="text/javascript">
       window._edrone = window._edrone || {};
       _edrone.action_type = 'homepage_view'; //override the default "other" value 
</script>

Mandatory fields
  • action_type

# Product View

Purpose: Send information, about the product viewed by a customer on the product page.

<script type="text/javascript">
       window._edrone = window._edrone || {};
       _edrone.product_skus = 'MAK03035';
       _edrone.product_ids = '3434';
       _edrone.product_titles = 'SANTI-DONNA'; // use url_encode
       _edrone.product_images = 'https://x.z..com/media/s/x/cache/3/image/df/3/u/3u1a6597--1200q100.jpg'; // use url_encode 
       _edrone.product_urls = 'https://x.z..com/3u1a6597--1200q100'; // use url_encode 
       _edrone.product_availability = 1;
       _edrone.product_category_ids = "12~24~36" // use "~" sign to separate values from each other 
       _edrone.product_category_names = "Buty~Buty damskie~Szpilki" // use "~" sign to separate values from each other and url_encode on single value
       _edrone.action_type = 'product_view';
</script>

Mandatory fields
  • product_ids
  • product_titles
  • product_images
  • product_urls
  • product_category_ids
  • product_category_names

# Category View

Purpose: Send information, about the category viewed by a customer on the category page.

<script type="text/javascript">
       window._edrone = window._edrone || {};
       _edrone.product_category_ids = "12~24~36" // use "~" sign to separate values from each other 
       _edrone.product_category_names = "Buty~Buty damskie~Szpilki" // use "~" sign to separate values from each other and url_encode on single value
       _edrone.action_type = 'category_view';
</script>

Mandatory fields
  • product_category_ids
  • product_category_names

# Add to cart

Purpose: Send information, about the product added to the cart.

<script type="text/javascript">
       window._edrone = window._edrone || {};
       let addToCartButton = document.querySelector("#addToCartButton")
       if (addToCartButton) {
         addToCartButton.addEventListener('click', () => {
           _edrone.action_type = "add_to_cart"
           _edrone.init()
         })
       }
</script>

Mandatory fields
  • product_ids
  • product_titles
  • product_images
  • product_urls
  • product_category_ids
  • product_category_names

# Order

Purpose: Send information, about the customer's order.

<script type="text/javascript">
       window._edrone = window._edrone || {};
       _edrone.action_type = 'order';
       _edrone.email = 'john.doe@edrone.me';
       _edrone.user_id = '1234';
       _edrone.first_name = 'John';
       _edrone.last_name = 'Doe';
       _edrone.subscriber_status = '1';
       _edrone.product_skus = 'NL1975286|NL2075286'; // use "|" sign to separate products from each other
       _edrone.product_ids = '12|13'; // use "|" sign to separate products from each other
       _edrone.product_titles = 'Sorel Women shoes Glacy|Sorel Women shoes Glacy Explorer Shortie'; // use "|" sign to separate products from each other and use url_encode
       _edrone.product_images = 'https://demo-store.edrone.me/img/p/4/5/45-large_default.jpg|https://demo-store.edrone.me/img/p/4/7/47.jpg'; // use "|" sign to separate products from each other and use url_encode
       _edrone.product_urls = 'https://demo-store.edrone.me/index.php?id_product=12&controller=product|https://demo-store.edrone.me/index.php?id_product=13&controller=product'; // use "|" sign to separate products from each other and use url_encode
       _edrone.product_category_ids = '2~3~4|2~3~4'; // use "|" sign to separate products from each other and "~" to separate values connected to product from each other and use url_encode
       _edrone.product_category_names = 'Main~Shoes~Women shoes|Main~Shoes~Women shoes'; // use "|" sign to separate products from each other and "~" to separate values connected to product from each other and use url_encode
       _edrone.product_counts = '1|3'; // use "|" sign to separate products from each other
       _edrone.order_id = '4321';
       _edrone.country = 'UK';
       _edrone.city = 'London';
       _edrone.base_currency = 'GBP';
       _edrone.order_currency = 'GBP';
       _edrone.base_payment_value = '671.50';
       _edrone.order_payment_value = '671.50';
</script>
Mandatory fields
  • email
  • first_name
  • product_titles
  • product_urls
  • product_images
  • product_category_ids
  • product_category_names
  • product_counts
  • order_id
  • country
  • city
  • base_currency
  • order_currency
  • base_payment_value
  • order_payment_value

# Order Cancel (backend only)

Purpose: Send information, about cancelation of the order.


<?php
  function order(){
    $$edroneData = 'version=' . '1.0.0' .
        '&app_id=' . 'YOUR_APP_ID' .
        '&email=' . $order->email .
        '&first_name=' . $order->first_name .
        '&last_name=' . $order->last_name .
        '&product_ids=' . join('|', $product_ids) .
        '&product_titles=' . join('|', $product_titles) .
        '&product_images=' . join('|', $product_images) .
        '&product_urls=' . join('|', $product_urls) .
        '&product_counts=' . join('|', $product_counts) .
        '&product_category_ids=' . join('|', $product_category_ids) .
        '&product_category_names=' . join('|', $product_category_names) .
        '&order_id=' . $order->order_id .
        '&order_payment_value=' . $order->order_payment_value .
        '&base_payment_value=' . $order->order_payment_value .
        '&sender_type=' . 'server' .
        '&base_currency=' . $order->order_currency .
        '&order_currency=' . $order->order_currency .
        '&action_type=' . 'order' .
        '&country=' . $order->country .
        '&city=' . $order->city .
        '&phone=' . $order->phone .
        '&customer_tags=' . join('|', $order->customer_tags) .
        '&subscriber_status=' . '' .
        '&event_utc_date=' . $order->event_date .
        '&utc_time=' . utcNow();
    return $edroneData;
    }

  function httpPost($url, $params) {
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_HEADER, false);
     curl_setopt($ch, CURLOPT_POST, count($params));
     curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
     $output = curl_exec($ch);
     curl_close($ch);
     return $output;
  }
  httpPost('https://api.edrone.me/trace', order());

Mandatory fields
  • order_id

# Subscribe

Purpose: Send information, about the customer subscription

WARNING

The front-end script only allows user enrollment. If you want to unsubscribe a person, use the backend script

<script>
  window._edrone = window._edrone || {};
  let newsletterForm = document.querySelector('#newsletterForm')
  if (newsletterForm) {
    newsletterForm.addEventListener('submit', () => {
      _edrone.customer_tags = 'Footer'; // You can use different tags for different forms.
      _edrone.email = newsletter.querySelector('input[type="email"]').value;
      _edrone.first_name = newsletter.querySelector('input[type="name"]').value;
      _edrone.action_type = 'subscribe';
      _edrone.init();
    })
  }
</script>

Mandatory fields
  • email
  • subscriber_status
  • customer tags
Optional fields
  • first_name
  • sms_subscriber_status
  • phone

# Additional features

# Syncing subscription statuses

If you want edrone to send updated email and SMS subscription statuses into your platform, check the subscription status sync

# Submit the integration

If you would like your platform integration to be visible on our integration list (opens new window), please contact us at partners@edrone.me