Track subID dynamically

This article is outdated. Please review our actual article SubID / Channels tracking

Several customers of ours asked:
"How could our affiliates dynamically track their subID or their custom data dynamically when a customer clicks the affiliate's banner?"

 
The answer is this:
 
First of all the merchant (or network owner in case of Post Affiliate Network) must enable in Post Affiliate Pro at Configuration > Tracking settings  the "Create channels automatically" option.
 
 
Now, let's say the affiliate copies the banner code from the affiliate panel and places it into his website. 
The banner code looks like this e.g.:
<a href="https://KindOfDestinationURL.com/#a_aid=testaffiliate&amp;a_bid=11110001" target="">
<img src="https://URL_TO_PostAffiliatePro/accounts/default1/banners/sample_image_banner.gif" alt="" title="" width="468" height="60" />
</a>
 
He would have to append the desired custom data (subID) as value of "chan" URL parameter, that way it will show up in the list of clicks (and sales if the sale is tracked based on cookie created by clicking this banner) in the "channel" column.
 
So the affiliate would have to add into the banner code's <a href="" >  part of code  kind of 'id', e.g.:
id="myBanner1"
 
So the banner code would look like:
<a id="myBanner1" href="https://KindOfDestinationURL.com/#a_aid=testaffiliate&amp;a_bid=11110001" target="">
<img src="https://URL_TO_PostAffiliatePro/accounts/default1/banners/sample_image_banner.gif" alt="" title="" width="468" height="60" />
</a>
NOTE: URL_TO_PostAffiliatePro is automatically replaced with the real URL address leading to Post Affiliate Pro (Network) when the affiliate copies the code from the affiliate panel.
 
Then somewhere under the banner (or into the footer of the page) the affiliate would have to add  a JavaScript code like this:
<script type="text/javascript">
var a1 = document.getElementById('myBanner1').href;
document.getElementById('myBanner1').href = a1+"&chan=DynamicSubID";
</script>
See, in that JavaScript code there is the 'myBanner1'  id, based on which the code knows which hyper link ( <a href=""> ) value it should modify. And there is also the chan URL parameter with the value of DynamicSubID.  
That DynamicSubID is supposed to be replaced with the affiliates desired data (subID). 
It is up to the affiliate what way he rigs up his custom data - whether he specifies explicitly or reads it via some custom code from somewhere.
 
That JavaScript code will cause, that the final destination URL of the banner (the <a href=""> value) where the customer will be redirected will include the chan=DynamicSubID parameter:
https://KindOfDestinationURL.com/#a_aid=testaffiliate&a_bid=11110001&chan=DynamicSubID
×