Can I pass data to my affiliate links or autoresponder?
You betcha—you just need to use a little magick.
The trick is to pass the data from one page to the next through either query string parameters or hidden form fields, using some JavaScript code to dynamically update the pages.
The way it works is pretty simple. When the page is loaded, the JavaScript code will search for all occurrences of the Sub-ID tokens `[s1]` through `[s5]` in the `((body))` section of the page and replace them with the corresponding `s1` through `s5` query string values passed to the page.
This lets you set values in links and hidden form fields without actually knowing what those values will be ahead of time. Just insert the tokens as placeholders and the magick will happen.
Query strings are a pretty important part of passing data to affiliate links, so if you don’t know what a query string is and how you pass data using them, you should study the following FAQ until you feel totally comfortable with the topic:

|  | What is a “query string”?

Finally, for each page that you want to pass data through, simply follow these steps:
Step 1: Add the following Sub-ID code to the very end of your page, just before the closing `((/body))` tag. (Some Page Builders call this the “footer” section, not to be confused with the `((footer))`… `((/footer))` tags.)
This is the code that dynamically replaces the `[s1]` through `[s5]` tokens in the `((body))` section of your page with the actual values of the `s1` through `s5` query string values passed to the page.
Caution: If you insert this Sub-ID JavaScript code at the top of the `((body))` section it won’t work correctly and may also cause your page to flicker or flash momentarily. To work correctly, this JavaScript code must be inserted as close to the final `((/body))` tag as possible.
Step 2: The next step is to use the Sub-ID tokens `[s1]`, `[s2]`, `[s3]`, `[s4]` and `[s5]` in the `((body))` section of your page wherever you want the corresponding `s1` through `s5` query string values to be inserted.
For example, if you want to add the value of the `s1` query string parameter to the end of your ClickBank affiliate link, you’d do it like this:
`http://xxx.yyy.hop.clickbank.net/?tid=[s1]`
If you want to pass any of the `s1` through `s5` query string values to a ClickMagick tracking link on the page, simply insert the tokens as Sub-IDs for the link:
`http://www.clkmg.com/$username/somelink/[s1]/[s2]/[s3]`
Caution: You cannot use the `[s1]` through `[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.
Step 3: The `[s1]` through `[s5]` tokens won’t work between `((script))`…`((/script))` tags. If you need to use any of the `s1` through `s5` query string values in existing JavaScript code, you must use the JavaScript variables `qsubids.s1`, `qsubids.s2` etc. to “build” the URL.
For example, instead of writing this link in your JavaScript code...
`window.open("http://www.site.com?s1=[s1]&s2=[s2]"); // Incorrect`
... which won’t work, you would need to code it this way:
`window.open("http://www.site.com?s1=" + qsubids.s1 + "&s2=" + qsubids.s2);`
Similarly, if you want to pass query string values to a ClickMagick tracking link in JavaScript code, you can’t write...
`window.open("http://www.clkmg.com/$username/somelink/[s1]/[s2]"); // Incorrect`
... which also won’t work. Instead, you would have to code it like this:
`window.open("http://www.clkmg.com/$username/somelink/" + qsubids.s1 + "/" + qsubids.s2);`
Step 4: Once you have your page set up, you can link to it by passing your Sub-ID values to your page by adding a query string to your link like this:
`http://www.site.com/page.html?s1=val1&s2=val2&s3=val3&s4=val4&s5=val5`
All of the Sub-IDs are optional, so you can omit any `name=value` pair or just leave the value blank for any Sub-ID you’re not using.
Step 5: If you need to pass Sub-IDs to multiple pages through a funnel, just repeat this process for every applicable page and then chain them all together.
Just remember that if you’re chaining two pages together through a tracking link rather than by a direct link, the Primary URL of the tracking link should pass on the Sub-ID values it gets by using the same `[s1]`-`[s5]` tokens:
Primary URL: `http://www.site.com/nextpage.html?s1=[s1]&s2=[s2]&s3=...`
Demo: Here’s a demo page with the JavaScript installed. Play with the query string parameters so you can see the code in action …

|  | Demo Page

Passing Data to your Autoresponder
To pass one or more Sub-IDs (including the click ID) through an email opt-in form, the best way is to pass the value through the Thank You page URL in the HTML generated by your autoresponder form editor.
Most autoresponders today have editors where you can design the opt-in form for your email opt-in page.
As you edit your form, look for a “Thank You” page setting or “Success” page URL setting and point it to the next page in your funnel.
Once you’ve created the opt-in form, you’re generally asked to “publish” it. You’re typically given two formats to publish your form in: an HTML version and a JavaScript version.
We’re hoping to find the “Thank You” page or “Success” page URL somewhere in the HTML or JavaScript code. If we find that, then passing sub-IDs (and the click ID) is super easy.
For instance, suppose your HTML looks something like this:
`((form action=”...”))
...​
((input type=”hidden” name=”thankyou_url” value=”http://www.site.com/thankyou.html"))
...​
((/form))`
Here you see a “hidden” URL with “thankyou” in the name and a value that points to the Thank You page you specified when you created the form.
To pass your Sub-ID, you simply need to add the `[s1]`—`[s5]` tokens to the Thank You page URL. So, if you were passing the click ID through the `s1` query string variable, you would create (or add) the `s1` variable to the URL:
`((input type="hidden" name="thankyou_url" value="http://www.site.com/thankyou.html?s1=[s1]"))`
If you’ve added the JavaScript Sub-ID code from Step 1, this will take the `s1` value that was passed to your opt-in page, and pass it right along to your Thank You page after the visitor’s email address has been captured.
You can see this entire set up process for both the Aweber and GetResponse autoresponders in this video from our Video Tutorials section:

|  | How to pass Sub-IDs through Email Opt-in Forms

Tip: The “[” and “]” characters are not allowed in URLs, so some autoresponders won’t let you directly enter the `[s1]`-`[s5]` tokens in the Thank You page URLs of their forms. If you run into this restriction, simply enter a fake URL for the Thank You page URL, then once you generate the autoresponder HTML for the form, simply replace the fake URL in the HTML code with the actual Thank You page URL that contains the `[s1]`-`[s5]` tokens.
What if there isn’t a Thank You page URL?
If your autoresponder doesn’t generate HTML code or doesn’t include the Thank You page URL when it does, then check the JavaScript code that it generates and look for the URL there. If you find one, follow the instructions in Step 3 to modify the JavaScript code correctly.
If for some reason, you simply cannot edit the Thank You page URL in the HTML or JavaScript code generated by your autoresponder, then you’ll need to read their documentation to see how you can pass “custom values” through their system.
If you can’t immediately find help for passing “custom values”, contact your autoresponder service for help with this. Remember, they know their system inside out and they are the experts for their system, not us …
Generally speaking, if you can’t modify the Thank You page URL, you’ll instead have to pass custom values in hidden data fields like this:
`((input type=”hidden” name=”custom1” value=”[s1]”))`
`((input type=”hidden” name=”custom2” value=”[s2]”))`
etc.
Once you’ve done this, you can then pass the custom values on to your Thank You page URL using whatever tokens your autoresponder system supports. You’ll need to set that part up inside your autoresponder settings.
If you need help configuring your autoresponder to pass custom values, contact the support folks for your autoresponder for help with this.
Caution: Modifying the `((head))`…`((/head))` section of your page is unpredictable, which means you can’t use the `[s1]`-`[s5]` tokens anywhere in your page header. It is especially important to remember that you cannot use these tokens in a “meta refresh” tag and expect them to work.
`// This meta refresh will not work reliably...`
`((meta http-equiv="refresh" content="3; url=http://mylink.com?s1=[s1]"))`
The need for a “meta refresh” usually comes up when you’re trying to create an intermediate or interstitial page to fire a tracking pixel. ClickMagick has a more effective approach using the advanced Pixel/Code feature of tracking links. You can get all the details in this FAQ:

|  | How can I set up an intermediate page to fire a pixel?