ClickMagick fully supports passing Sub-IDs in its tracking links and rotator links, but sometimes it’s necessary to pass Sub-IDs through pages in your funnel and this can be a bit tricky.
Passing Sub-IDs through your funnel pages isn’t really a ClickMagick issue, but it does come up when you’re trying to pass a click ID from your tracking link through a series of pages in your funnel and on to an affiliate network.
Historically, to do this meant creatively passing your sub-IDs through your funnel pages using query string parameters, hidden input fields in forms, and so on. And if you had an opt-in page someplace in the middle, passing a Sub-ID through your autoresponder was often a nightmare.
To make passing Sub-IDs through your funnel pages much easier, we have a simple solution that should work in the vast majority of the situations.
This is the piece of code that you would paste into either the <head> or <body> section of your page:
Take a look at this funnel which has an opt-in page and a Thank You page that leads into the affiliate network:
Passing the Sub-ID values
To pass the Sub-ID values from your tracking link, use the query string variables cm_s1 through cm_s5.
For example, if you were passing a click ID to your affiliate network and you needed to go through some intermediate pages, you would pass the click ID in the Primary URL of your tracking link using the cm_s1 query string parameter:
With this setup, the tracking link’s click ID would be successfully passed to your affiliate network no matter how many pages were between the first and last page.
If you pass in query string values on the same page that you use the tokens, the query string values will update the cookies before the cookied values are used to replace the tokens.
Tip: For the detail-oriented folks, the cookies are 1st-party cookies with a 1-year expiration date.
Passing the Cross-Device ID
cmtools.js also allows you to pass the tracking link and rotator link cross-device IDs through your pages. This works exactly like passing and replacing any of the sub-IDs explained the previous section.
When a page is loaded, cmtools.js looks for two query string parameters, clk_vid and rot_vid, and stores them in cookies with the same name.
If you want to use those values later on in your HTML, just use the tokens [clk_vid] and [rot_vid] and those tokens will be replaced with the values passed in through the query string. The most common use for these tokens is to set a hidden value in an autoresponder form so you can add the value to links in emails that you send.
For example, with the AWeber autoresponder, a hidden form field with the custom name “clk_vid” would look like this:
Every autoresponder will be a little bit different for how you would create a hidden form field. Simply search their documentation for “create hidden form field” and you should get instructions for your particular autoresponder.
The cmtools_attrs variable
By default, cmtools.js only updates tokens in the href, src, and value attributes of HTML tags.
cmtools.js code give you some flexibility here.
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:
var cmtools_attrs = ['placeholder'];
If you wanted both the placeholder and data-custom attributes updated, you would separate them with a “,”:
var cmtools_attrs = ['placeholder', 'data-custom'];
You could use this special variable, for example, to redirect to a new page:
Tip: If your pages link from one domain to the next, you can still use ClickMagick’s Sub-ID code to pass your Sub-ID values. All you need to do is pass the values from the last page of the current domain to the first page of the next domain using the Sub-ID code itself.
In other words, use the Sub-ID code on the last page of the first domain to set the cm_s1 through cm_s5 query strings parameters in the link leading to the next page on the new domain. Then, on the first page of the new domain, use the Sub-ID code to grab the query string parameters and start the process on the new domain.
Article 482 Last updated: 03/14/2021 12:37:48 PM https://www.clickmagick.com/kb/?article=482