Tracking + Analytics

Optimize your app with measurement and analysis tools.

Converting a tracking pixel from HTML to JavaScript

Track activities so you can get an idea of how your users behave in your mobile shop. This is an invaluable tool, as studying user behaviors help you improve your sales methods to increase sales.

How do you do this? The answer is the tracking pixel. Also known as a 1x1 pixel, this is a graphical element that loads when a user visits an app and website. You can embed a tracking pixel in Javascript on your Shopgate mobile apps and website by following these instructions.

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, just convert the code into Javascript following the steps below.

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;" imgtag.style = 'border-style:none;';
5. alt="" imgtag.alt = '';
6. src="//googleads.g.doubleclick.net/pagead/
viewthroughconversion/928691177/?value=0"
imgtag.src = '//googleads.g.doubleclick.net/pagead
/viewthroughconversion/928691177/?value=0';


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.

    TrackingTools.png

  2. Locate the Tracking codes section, select a platform and a page to display the code, and click +Add.



  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 Embedding a custom tracking code.

 

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