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:
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
1.
Copy the JavaScript code below and add it to the header section of the Tracking Code in the ClickFunnels page settings.
2.
Save your changes once you’ve added the code so the header section.
3.
Copy the URL for the page in ClickFunnels so you can use it in your tracking link.
4.
Head back to ClickMagick and go to Tracking Links.
5.
Either create a new link or click on one you’ve already created.
6.
Edit the Primary URL of the tracking link (which points to the ClickFunnels page you are editing) to include the following string at the end of the URL: ?cm_s1=[clickid]
7.
Save your changes to the tracking link (Either click “Save Changes” or “Create Tracking Link”, depending on if you are editing or creating the tracking link).
8.
Back in ClickFunnels, click on the button you want to track and click “Set Action” in the pane on the right.
9. Click “Go to website URL” and add your URL to the box. At the end of the URL, add the following string: ?tid=[cm_s1]
10.
Click away from the button menu and click “Save” in the top right of the ClickFunnels page, and then you’re all set!
How To Pass Data To Your Affiliate Links In LeadPages
1.
Copy the JavaScript code listed below and add it to the page settings in LeadPages, save the settings, then click “Update” on the page.
2.
Preview the page in LeadPages and copy the link to use it in your tracking link.
3.
Go back to ClickMagick and head to Tracking Links.
4.
Create a new link (or click on any existing link you already have set up)
5.
Add the URL you just copied to the “Primary URL” field, and then add the following code to the end of the URL: ?cm_s1=[clickid]
6.
Save changes
7.
Now go back to LeadPages and find the button you want to track the value.
8.
Click on the button and then click on “Edit Click Event”
9.
From there, you want to make sure you add the following code to the end of the URL that’s listed in the click event for the button: ?tid=[cm_s1]
10.
Save your changes in LeadPages, and now you’re all set!
How To Pass Data To Your Affiliate Links In OptimizePress
1.
Copy the JavaScript code below and go to your landing page in OptimizePress.
2.
Click the Settings button, then expand the “Page Scripts” menu.
3.
Add the tracking code to the “Header Script” section and save the page.
4.
Preview the page inside OptimizePress and copy the URL to the page so you can use it in your tracking link.
5.
Back in ClickMagick, go to Tracking Links, then create a new link or edit one you already have.
6.
Add the link to the page in the “Primary URL” field and add this string to the end of the URL: ?cm_s1=[clickid]
7.
Save your changes to the tracking link.
8.
Go back to OptimizePress and click on the button you want to edit, click the link icon, and add this string to the end of the link: ?tid=[cm_s1]
9.
Now all you need to do is save the page in OptimizePress and now you’re all set!
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, 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 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.
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 the following:
<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 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: