Note: The cm_subids.js code is no longer supported. The latest version is called cmtools.js. cmtools.js is backwards compatible with cm_subids.js so you can safely update from cm_subids.js to cmtools.js. You can read about cmtools.js in this article:
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.
The cm_subids_attrs variable
ClickMagick’s Sub-ID code give you some flexibility here.
First, if you declare the special cm_subids_attr array with one or more HTML attribute types, the Sub-ID code will make replacements in those fields as well. For example, if you wanted all your placeholder attributes updated, you would include cm_subids_attr array before you include the script:
var cm_subids_attrs = ['placeholder'];
If you wanted both the placeholder and data-custom attributes updated, you’d separate them with a “,”:
var cm_subids_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 400 Last updated: 01/29/2021 1:58:47 PM https://www.clickmagick.com/kb/?article=400