Google Analytics: Javascript tag

We provide a fast and simple solution to add the Google Analytics Custom to affiliate links with a JavaScript tag.

This script will automatically find the Client ID, create the Custom, and add to all your affiliate links the Custom according to your settings.

Install the Javascript Tag

On Strackr, in the Integrations section, Google Analytics tab, and click on the JavaScript snippet icon:

Javascript snippet

  • The JavaScript tag should be added after the Google Analytics tag on each page that you want to track sales.
  • This code will download the JavaScript file and initialize the strackr global function.
  • The command update will add Custom to your affiliate links.

Custom position

By default, the script will only add a Custom if the affiliate link has an empty Custom. If the network provides an alternative parameter and you don't use it, the script will add the Custom to the alternative parameter.

Example with an Awin link:**clickref=YOURINTERNALCUSTOM**&

The script edits the link:**clickref=YOURINTERNALCUSTOM**&**clickref2=STKRgSfhPMjA4MDc4OTQwLjE2NTQ4MTkyMDI=STKR**

But if a network doesn't provide an alternative parameter like Tradetracker, by default, the script will not change your link:

To track those networks with Google Analytics, the script will have to concatenate your custom + the GAC (example mycustomSTKRgSfhPMjA4MDc4OTQwLjE2NTQ4MTkyMDI=STKR), we use STKR as delimiter at the beginning and the end of the GAC, so if you use the API, in your application you will just have to delete that part.

Here is an example how to set the Custom positon:

strackr('create', 'ga', 'STIDTOREPLACE');
strackr('setting', 'customposition', 'POSITION');

Replace POSITION by any value according to your needs: default, left, right.

If you choose right, for the Tradetracker's example you will have YOURINTERNALCUSTOM + STKRgSfhPMjA4MDc4OTQwLjE2NTQ4MTkyMDI=STKR:**r=YOURINTERNALCUSTOMSTKRgSfhPMjA4MDc4OTQwLjE2NTQ4MTkyMDI=STKR**

Cloaked affiliate links

If you cloak your affiliate links and using a redirection page, you can use a helper to create a link with the Custom.

Install the Javascript tag (you don't need to use the command update) and adjust your code to be able to use the helper:

// An example of how to use the helper
function getTrackingUrl(url) {
    if (typeof strackr !== 'undefined') {
        strackr((helper) => {
            var trackingUrl = helper.getUrl(url);
            if (trackingUrl){
                return trackingUrl;
    return url;

// Here your redirection process
window.location.href = getTrackingUrl(url);

The user will be redirected to the affiliate link with the Google Analytics Custom.

Use a Proxy

Some browsers, such as Safari, can block third-party JavaScript from accessing the Google Analytics JavaScript API. To bypass this, you can utilize a proxy for your script. Essentially, a proxy maps specific URLs from your domain to the Strackr domain: ->

When the browser requests a file at, it will actually retrieve it from

There are various methods to proxy requests to Strackr, and the best method often depends on your hosting situation. You can use proxy modes available in servers like Apache2 or Nginx. Alternatively, a standalone proxy can be established regardless of the hosting provider or tech stack you employ. However, integrated proxy setups will vary based on your app deployment.

Available Networks

Below is a list of networks available via the JavaScript tag:

  • Awin
  • Daysicon
  • Tradetracker
  • Shareasale
  • Kwanko
  • Adtraction
  • Adrecord
  • Webgains
  • Flexoffers
  • Admitad
  • eBay Partner Network
  • Effiliation
  • Rakuten Marketing
  • Sovrn Commerce
  • financeAds
  • CommunicationAds
  • Tradedoubler
  • Partnerize
  • CJ Affiliate
  • Kelkoo
  • Affilae
  • retailAds

If a network you use is missing from the list, kindly contact us with a URL example and the subid. We'll ensure it's added.

    Get started for free

    30 days free trial, no credit card required. Connect to your networks within minutes — and cancel anytime.

    Try for free

    Try the live demo

    Not quite ready to sign up? Take a test drive of the Strackr dashboard in our interactive live demo.

    See the live demo

    Still have questions?

    If there’s anything else you want to know about Strackr, contact us and we’ll be happy to fill you in.

    Contact us