Knowledge Base      


How do I pass additional data to my affiliate network?


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) 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 unsure about “query strings”, you should read the following article to get comfortable with them first:
 
What is a “query string”?
 

Now here’s how you can pass Sub-ID values throughout your funnel using some of the more well-known funnel builder software:


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.   
Add the following JavaScript code in the “head” or “body” section of the first and last pages of your funnel to load cmtools.js:

<script src='//cdn.clickmagick.com/misc/js/cmtools.js'></script>

This code will save the cm_s1 through cm_s5 query string values in cookies with the same name.
 

  
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:

https://www.site-page1.com/page.html?cm_s1=value1&cm_s2=value2&...&cm_s5=value5

All of the Sub-IDs are optional, so that you can omit any name=value pair or leave the value blank for any Sub-ID you’re not using.

    
3.    If you want to pass the values from Page 1 of your website to Page 2, you’ll pass them like this:

https://www.site-page2.com/page.html?cm_s1=[cm_s1]&cm_s2=[cm_s2]&...&cm_s5=[cm_s5]

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, insert the tokens as Sub-IDs for the link:

https://www.clkmg.com/[USERNAME]/somelink/[cm_s1]/[cm_s2]/…/[cm_s5]

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 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?
 
What if I need to pass data to an image?
 
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 first domain's last page and replace Sub-ID tokens in the URL that leads to the page on the second domain. Just add the same JavaScript code on the 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 works, read this:
 
How does the JavaScript cmtools.js code work?


Article 99 Last updated: 11/21/2024 2:28:32 PM
https://www.clickmagick.com/kb/?article=99