Understanding the mechanisms behind click tracking is essential for effectively managing your affiliate program with Post Affiliate Pro. The platform supports five distinct linking methods, each offering a unique link style and behavior in how clicks are captured. This article explains each method in detail, helping you choose the most suitable one for your affiliate marketing strategy and providing guidance on troubleshooting.
Overview of Click Tracking Methods
The following click tracking methods are available in Post Affiliate Pro:
- Redirect Links
- Direct Links
- New Style, Anchor, and Short Anchor Links
- ModRewrite Links
Each method offers a different approach to tracking and recording clicks, which impacts reporting accuracy, ease of deployment, and user experience.
1. Redirect Links (Standard Links)
These links appear as follows:
URL_TO_PostAffiliatePro/scripts/click.php?a_aid=refid&a_bid=73d672s1
Tracking occurs when the link is clicked and the request is sent to the click.php script. The script evaluates the parameters and records the click if everything is correct. Once the click is saved, the customer is redirected to the banner destination URL defined in the specific banner (in this example, the banner with ID 73d672s1), or to the Main site URL or Declined site URL as defined in your merchant panel under Configuration > Tracking Settings.
However, since version 5.4.24.3, there is an option to hash the tracking script names, so it may not necessarily be click.php; it can be a random string, such as /scripts/zhkc57n4awm. If you see the letter 'c' in this string, you can be sure it is the click.php tracker.
This is the easiest link type to debug because you only need to add &PDebug=Y to the end of the URL and open it in your browser (debugging via this parameter must be enabled first under Configuration > Event logging!). You will see the complete logs for the click-saving process, allowing you to identify why it did not track. For example:
URL_TO_PostAffiliatePro/scripts/click.php?a_aid=refid&a_bid=73d672s1&PDebug=Y
Possible reasons include:
- Incorrect URL parameters: Go to Configuration > URL parameter names and check whether a_aid and a_bid are set for affiliate and banner IDs.
- Affiliate not approved: Check in Affiliates > Affiliates manager for the affiliate ID from the link.
- Campaign: The banner's campaign is not Active or is set as private or public with manual approval (Private Campaigns feature), and the affiliate is not invited.
- Fraud protection: Check Configuration > Fraud protection > Click tracking.
2. Direct Links
DirectLink Tracking is a specialized case and has its own debugging article.
3. New Style, Anchor, and Short Anchor Links
These links point directly to your website, which must be integrated with click tracking code. After the link is clicked, the parameters must remain in the URL in your browser's address bar on the landing page so the click tracking code can read them. Here is how these links appear:
New Style link
https://www.yourdomain.com/?a_aid=AffiliateID&a_bid=BannerID
Anchor link
https://www.yourdomain.com/#a_aid=AffiliateID&a_bid=BannerID
Short Anchor link
https://www.yourdomain.com/#AffiliateID&a_bid=BannerID
4. ModRewrite Links
These links function almost identically to redirect links but rely on the .htaccess file and mod_rewrite rules on your domain, which are generated by Post Affiliate Pro based on your link configuration. This link type is relatively complex to set up, so it is assumed that users are familiar with its configuration. ModRewrite links depend on .htaccess rules which, according to the settings in the PAP merchant panel (Configuration > Tracking settings), parse the opened URL and execute a call to click.php or its hashed counterpart containing the 'c' character, just as Standard/Redirect links do. If a ModRewrite link is not working, test your .htaccess to ensure it makes the request to click.php (or its hashed version) and redirects to the destination URL, then follow the steps described for Standard links to troubleshoot.
Debugging
1. Check URL parameters
The first step in debugging these links or banners is to click the actual link with your browser's Developer Tools (such as Firebug in Firefox or the Network tab in Chrome/Edge) enabled. For example, click this test link:
localhost/test/landing.html#a_aid=testaff&a_bid=40039433
After clicking, check the address bar to ensure the URL parameters (such as #a_aid=testaff&a_bid=40039433) are still present on the landing page. Some websites may have redirects that do not preserve these parameters; in such cases, even with correct click tracking code, the system cannot read the parameters and will not record the click.
2. Check if communication works
The second step is to check the Network tab of your Developer Tools to see if a request was made to Post Affiliate Pro's track.php script or its hashed equivalent (which always contains the letter 'r') and whether its status was 200 OK.
In the screenshot above, you can see two other Post Affiliate Pro calls being made to trackjs.js and its hashed equivalent zhkJ57n4awm (always containing the letter 'j'), and to pap.swf or its hashed equivalent zhkJ57n4awm.swf. The call to trackjs.js indicates that the click tracking JavaScript header was initialized, but does not guarantee actual tracking. The call to pap.swf creates a flash cookie in the visitor's browser, which is a good sign.
The key call to look for is to track.php or its hashed equivalent containing the letter 'r' (e.g., zhkr57n4awm). This means the click tracking code attempted to save the click and create cookies.
The easiest and most reliable way to debug is to right-click this call in the Network tab and select Copy Location to capture the URL with all its parameters. Then, open this URL in a browser tab, adding the &PDebug=Y parameter at the end. For example:
https://localhost/PAP/scripts/zhkr57n4awm?visitorId=f960d52a72b3d4e7b54ba62zYENYx285&accountId=default1&tracking=S&url=H_localhost%2Ftest%2Flanding.html&referrer=&getParams=&anchor=a_aid%3Dtestaff%26a_bid%3D40039433&isInIframe=false&cookies=&PDebug=Y
Opening this URL will display the logs for saving the click, allowing you to review them and identify any issues in recording the click.
3. Check the configuration
The third step is for cases where the logs from the previous steps are unclear, and covers all possibilities for why a click might not be saved. This step assumes the call to track.php (or its hashed equivalent) was made and returned a 200 OK status.
- Incorrect URL parameter names: Check in Configuration > URL parameter names that these are set correctly as reflected in your link.
- Affiliate not approved: Check in Affiliates > Affiliates manager whether the affiliate with the ID in the link is approved.
- Campaign: The banner's campaign is not Active or is set as private or public with manual approval (Private Campaigns feature), and the affiliate is not invited or added. If no banner is used in the link, the default campaign is selected.
- Account mismatch: (For Post Affiliate Network users only) The accountId in the click tracking code does not match the account under which the click should be saved, so the recognized campaign does not belong to the account whose click tracking code was executed.
- Fraud protection: Check Configuration > Fraud protection > Click tracking.
- Crashed database tables: (For self-hosted licenses only) Contact your server admin or hosting provider to check your Post Affiliate database for crashed tables. A good indicator is if the click is saved when adding &PDebug=Y, but not otherwise. In these cases, one of the qu_g_visits tables is likely crashed.
- Incorrect order of query string and anchor parameters in combined links: When a link contains both query string (?) and anchor (#) parameters, the anchor must always come last. For example:
Incorrect Anchor link:
https://www.yourdomain.com/#a_aid=affiliate&a_bid=banner?utm_source=source&utm_medium=medium&utm_campaign=campaign
Correct Anchor link:
https://www.yourdomain.com/?utm_source=source&utm_medium=medium&utm_campaign=campaign#a_aid=affiliate&a_bid=banner
Incorrect New Style link:
https://www.yourdomain.com/#productA?a_aid=affiliate&a_bid=banner
Correct New Style link:
https://www.yourdomain.com/?a_aid=affiliate&a_bid=banner#productA
To conclude: The anchor and its parameters must always come last.
Debugging with Event Logging
Another option for debugging is to use Event Logging, which is essentially the same as using the PDebug=Y parameter. In older versions of Post Affiliate Pro where PDebug=Y is not available, this may be the only way to check the logs and determine why a click was not saved.
In your merchant panel, navigate to Configuration > Event logging and enable Clicks in the Debug section, then save the changes. Next, perform a test click and turn debugging off. Go to Tools > Event logging to browse the event logs. This should help you identify the problem. For accounts using cron jobs (all hosted accounts use cron jobs), you may need to wait up to 15 minutes for the click to be processed and logged.