Tracking + Analytics

Optimize your app with measurement and analysis tools.

Converting a Tracking Pixel from HTML to JavaScript

Tracking pixels are available on Shopgate. You can embed a tracking pixel in Javascript on your Shopgate mobile apps and website using the tracking codes function. 

What is a tracking pixel?

A tracking pixel, or a 1x1 pixel, is a graphical element that loads when a user visits an app and website. This pixel can track activities that could give you an idea of how your users behave in your mobile shop. By studying user behaviors, you could improve your sales methods to increase sales.

If using such a tracking pixel, you should be able to find an HTML snippet in your tracking code similar to this:

To use this tracking pixel on your Shopgate mobile apps and website, please convert the code into Javascript.

Converting the pixel into Javascript

The simple steps and rules to convert your tracking pixel can be found below:

Remove the <div> tags

The first step is to remove the <div> tags. In this example, the tags are:

<div style="display:inline;"> and </div>

Rewrite the <img> contents

The contents inside the <img ..../> need to be converted into the Javascript style.

In this example, the <img .../> tag and its contents can be broken down into five different elements:

  HTML code Convert to Javascript with this code:
1. <img ..../>  var imgtag = document.createElement('img');
2. height="1" imgtag.height = '1';
3. width="1" imgtag.width = '1';
4. style="border-style:none;" = 'border-style:none;';
5. alt="" imgtag.alt = '';
6. src="//
imgtag.src = '//

The resulting Javascript should look like this:

Now your tracking pixel has been converted from HTML to Javascript.


Entering your tracking code

After your tracking pixel has been converted, enter it at your Shopgate Admin:

  1. Click Settings from the menu bar, then select Tracking Tools.

  2. Locate the Tracking codes section, select a platform and a page to display the code, and click +Add. Click here to see the available platforms and pages.

  3. Enter a title and your tracking code in the script editor. Turn Autovalidation to ON so your shop will have extra security and coding accuracy. Your code will be validated before it can be saved.
  4. Click Save.

That's it! You have successfully set up a tracking pixel. Repeat the steps here to enter another code if needed.

To learn more about the tracking codes function and all its options, please read Setting up tracking codes for your mobile shop.


Was this article helpful?
Can't find what you're looking for?
Let us help you—submit a support ticket.
Contact Support