JS tracker

Overview

Loymax SmartCom JS tracker is a small piece of JavaScript code, installed on the user's website similar to Google Analytics tracker. The tracker registers customer's visit to the website and links this visit to the customer's profile on the Platform.

Based on data from the tracker, the Platform builds a map of customer interests with respect to products and product categories, and allows implementation of abandoned cart returns and other web triggers.

Features

The tracker captures the following web events:

  • Website visit (start of the new session);

  • Product preview;

  • View product category;

  • View section (string name of the section is fixed; for example, action_xxx, application_partnership);

  • Authorization/customer registration;

  • Abandoned cart processing;

De-anonymizing

The Platform stores a 60-day history of anonymous visits. This means that if an unidentified visitor has performed actions on the website (such as being interested in certain products) and then within 60 days has logged in or registered on the website, that visitor's actions will be "filed" in the corresponding customer profile on the Platform.

If a customer was never authorized on the website or placed orders on the website, he/she can still be automatically identified if he/she clicks on the link from the Platform newsletters at least once.

It is recommended to conduct mailings at least 2-3 times per month, "marking" customers to effectively collect data on their behavior on your website.

Setting up the tracker

Tracking code

Set the tracking code loading on all pages of your website.

<script type='text/javascript'>
  var _gcTracker = _gcTracker || [];
  _gcTracker.push(['init', 'SHOP_ID', 'ESRC_ID']);
  
  (function() {
    var s = document.createElement('script');
    s.type = 'text/javascript'; s.async = true; s.src = '//stat.loymaxsc.net/tracker/v1.0/tracker.min.js';
    document.getElementsByTagName('head')[0].appendChild(s);
  })();
</script>

where

  • (int) SHOP_ID is your numeric identifier on the Platform. To get it, write a request to our technical support team.

  • (string) ESRC_ID is the event source identifier which corresponds with sources specified in the settings, for example: online store/mobile app.

The ESRC_ID parameter can be empty. If it is not specified, the event source ID will be the one specified by default in the settings.

Example:

<script type='text/javascript'>
  var _gcTracker = _gcTracker || [];
  _gcTracker.push(['init', '123456789', 'main_web']);
  
  (function() {
    var s = document.createElement('script');
    s.type = 'text/javascript'; s.async = true; s.src = '//stat.loymaxsc.net/tracker/v1.0/tracker.min.js';
    document.getElementsByTagName('head')[0].appendChild(s);
  })();
</script>

It is desirable to place a tracker code as close as possible to the beginning of the page after the code of the main Google Analytics counter.

Loading the tracking code must be done BEFORE the calls described in the following paragraphs.

Authorization and registration

Add a tracking code call to authorization and registration events

_gcTracker.push(['user_login', { user_id: 'USER_ID' }]);

where (string) USER_ID the unique identifier of customer in your information systems.

Example:

<script type='text/javascript'>
  _gcTracker.push(['user_login', { user_id: '65535' }]);
</script>

As USER_ID use the code that is passed through the integration as the primary key in the Platform.

View section

Add a tracking code call on the section view event:

_gcTracker.push(['view_page', { name: 'PAGE_NAME' }]);

where (string) PAGE_NAME page ID, which you can later use when setting up the Customer visited section trigger.

Example:

<script type='text/javascript'>
  _gcTracker.push(['view_page', { name: 'view_partnership_conditions' }]);
</script>

View product category

Add tracking code call on the product category view event

_gcTracker.push(['view_category', { category_id: 'CATEGORY_ID' }]);

where (string) CATEGORY_ID is a product category identifier in your information system.

Example:

<script type='text/javascript'>
  _gcTracker.push(['view_category', { category_id: '214' }]);
</script>

This code is usually located on the product list page of a product category.

Use that category code as the CATEGORY_ID, which is passed to the Platform through the integration.

Product preview

Add a tracking code call on the product preview event:

_gcTracker.push(['view_product', { category_id: 'CATEGORY_ID' , product_id: 'PRODUCT_ID' }]);

where:

  • (string) CATEGORY_ID product category identifier in your information systems.

  • (string) PRODUCT_ID product identifier in your information systems.

Example:

<script type='text/javascript'>
  _gcTracker.push(['view_product', { category_id: '218' , product_id: '1735' }]);
</script>

This code is usually located on the product card page.

As CATEGORY_ID and PRODUCT_ID use those category and product codes that are passed to the Platform through the integration.

Adding product to cart

Add tracking code call on the event of adding a product to cart:

_gcTracker.push(['add_to_card', { category_id: 'CATEGORY_ID' , product_id: 'PRODUCT_ID' }]);

where:

  • (string) CATEGORY_ID is a product category identifier in your information systems.

  • (string) PRODUCT_ID is a product identifier in your information systems.

Example:

<script type='text/javascript'>
  _gcTracker.push(['add_to_card', { category_id: '218' , product_id: '1735' }]);
</script>

Removing product from cart

Add a tracking code call on the event of removing product from cart:

_gcTracker.push(['remove_from_card', { product_id: 'PRODUCT_ID' }]);

where: (string) PRODUCT_ID is a product identifier in your information systems.

Example:

script type='text/javascript'>
  _gcTracker.push(['remove_from_card', { product_id: '1735' }]);
</script>

Cart cleanup

Add a tracking code call on cart cleaning up event:

_gcTracker.push(['clear_card', {}]);

The method has no parameters.

Example:

<script type='text/javascript'>
  _gcTracker.push(['clear_card', {}]);
</script>

Checkout completion

Add tracking code call to checkout completion event:

_gcTracker.push(['order_complete', { order_id: 'ORDER_ID' }]);

where: (string) ORDER_ID order identifier in your information systems.

Example:

<script type='text/javascript'>
  _gcTracker.push(['order_complete', { order_id: '20713' }]);
</script>

This code is usually located on the "Thank you, your order has been successfully completed" page.

As ORDER_ID use the order identifier that is passed to the Platform through the integration.

Registering arbitrary event

The tracker can register arbitrary user-defined events, such as news subscription, event recording, or product availability subscription. To register an event, add a call to the event registration code:

_gcTracker.push(['event', { name: 'EVENT_NAME', context: 'JSON' }]);

where: (string) EVENT_NAME is event name, which you can later use when configuring the Platform trigger.

Example:

<script type='text/javascript'>
  _gcTracker.push(['event', { name: 'news_signup', context: '[news_group: 1]' }]);
</script>

Last updated