Sometimes you might want to pass more than just a click ID to your affiliate network.
ClickMagick’s cmtools.js JavaScript code allows you to store and pass up to 5 Sub-ID values (cm_s1 through cm_s5) all the way from the first page of your funnel to the last page.
Because these Sub-ID values are stored in browser cookies, you only need to add the cmtools.js code to the first and last pages of your funnel.
This article talks about “query strings” a lot. so if you’re a unsure about “query strings”, you should read the following article to get comfortable with them first:
Now here’s how you can pass Sub-ID values throughout your funnel:
How To Pass Data To Your Affiliate Links In ClickFunnels
How To Pass Data To Your Affiliate Links In LeadPages
How To Pass Data To Your Affiliate Links In OptimizePress
1.
2.
Once you have your pages set up, you can pass your Sub-ID values cm_s1 through cm_s5 to the first page of your funnel by adding a query string to the Primary URL of your tracking link like this:
The cmtools.js code you added to Page 1 will convert the [cm_s1] through [cm_s5] tokens to their values before the link is used.
If you want to pass any of the cm_s1 through cm_s5 query string values to a ClickMagick tracking link on the page, simply insert the tokens as Sub-IDs for the link:
As an example, let’s assume you have a ClickBank affiliate link. If you want to add the value of the cm_s1 query string parameter to the end of your ClickBank affiliate link in order to pass a click ID, you’d do it like this (assuming you passed the click ID in the Sub-ID 1 slot):
https://xxx.yyy.hop.clickbank.net/?tid=[cm_s1]
What if I’m using JavaScript?
If you’re using JavaScript and need to use the Sub-ID values, use the JavaScript variables cmtools.s1 though cmtools.s5.
Instead of writing this link in your JavaScript code (which won’t work)...
By default cmtools.js only updates tokens in href, src, and value attributes of HTML tags.
Meaning, the code will not update any HTML attributes other than the ones mentioned.
However, the cmtools.js code does provide you with some flexibility in case your image links aren’t using the standard attributes.
First, if you declare the special cmtools_attrs array with one or more HTML attribute types, cmtools.js will make replacements in those fields as well. For example, if you wanted all your placeholder attributes updated, you would include cmtools_attrs array before you include the script:
<script>
var cmtools_attrs = ['placeholder'];
</script>
<script type='text/javascript' src='//cdn.clickmagick.com/misc/js/cmtools.js'></script>
ClickFunnels uses the data-imagelink attribute if you make your images clickable.
So to make the change when adding the above code to ClickFunnels you would use:
<script> var cmtools_attrs = ['data-imagelink'];
</script>
<script type='text/javascript' src='//cdn.clickmagick.com/misc/js/cmtools.js'></script>
Caution: You cannot use the [cm_s1] through [cm_s5] tokens in the <head> section of a page. Replacing text in the <head> section is undefined behavior in HTML and does not work in all browsers.
That’s it! You should now be able to pass your Sub-ID values throughout your funnel, no matter how many pages it has.
Note: For this cookie approach to work, the page where the URL values are stored and the page where the Sub-ID tokens are replaced must be on the same web domain, which will be true in almost all cases.
If you need to switch domains partway through your funnel, add the JavaScript code to the last page of the first domain and use it to replace Sub-ID tokens in the URL that leads to the page on the second domain. Just add the same JavaScript code on that first page of the second domain to store the Sub-ID values in cookies on the second domain.
Tip: For a detailed discussion on how the cmtools.js code actually works, read this: