Tracking conversions with Javascript (V1)

Please note -- we have now released a version 2 Javascript tracking code and API. This documentation is kept since users may still have the old JS in use. Do not use this documentation if you are implementing JS tracking for the first time.

Much like tracking page views, you can track conversion events with our JS.

You need to make sure our global include JS has been loaded first, and then you can fire a conversion with this code (excuse any odd formatting, this knowledgebase often mangles things a bit!).

<script>
lum.event('conversion', {
    'query': {
        'rev': '',
        'tx': '',
        'p': 'SOME_VALUE',
        'hit': '',
        'vid': ''
    },
    'onDone': function(response) {}
});
</script>
<noscript>
<img height='1' width='1' style='display:none' src='https://DOMAIN/pb/event?type=conversion&rev=&tx=&p=SOME_VALUE&hit=' />
</noscript>

This code can be retrieved from an offer's settings:

Here we have included a <noscript> version as well, which lets you fire conversions with an img pixel if you cannot use JS.

In the above code, here is what the parameters mean:

  • rev = revenue of the conversion
  • tx = transaction ID of the conversion
  • p = page ID that is converting (must be an offer)
  • hit = hit ID that is converting (very specific)
  • vid = visitor ID that is converting (less specific, identifies the visitor)

All parameters are optional, but we suggest always having the page ID value, as you'll virtually always know what page should be converting.

If you don't specify one, we'll find the most recent offer visited by the user and mark that as converting.

Additionally if you are passing a hit ID, you don't need to pass VID (less specific).

In most cases you will fire this conversion JS after you have left the page that converted, so its important to declare the right page ID -- go to your offers in FunnelFlux > edit > conversion tracking to get the code for a specific page.

Our JS will be aware of the visitor's ID (vid) through either cookies, if enabled/available, the browser URL, or referrer -- we do a good job of keeping track of this value without work needed on your end.

But, if able, you can directly inject known parameters into the JS code. For example, if you are redirecting users to some offer from an affiliate network, you can pass our {hit} token in the offer URL, then inject it back into the JS using one of their tokens - much like you would with a postback URL.

When you use our JS on a page to fire conversions, we will also piggyback in any client-side tracking configured in your traffic source and execute it too, i.e. this stuff:

Having trouble?

Try checking our conversion tracking debugging article HERE.

Was this article helpful?