The topic of debugging sale/action tracking requests is quite extensive, as there are many different integration approaches that may send tracking requests to the application in various ways. As a result, it is difficult to write a comprehensive and complete guide on how to debug every single option.
If you have integrated PayPal buttons and these are not being tracked, please follow the PayPal button debugging article.
This article covers regular thank you page tracking, where a code (JavaScript or HTML pixel) should be executed on the thank you page to notify Post Affiliate Pro about the order. Its aim is to explain how you can determine why your code is not communicating with Post Affiliate Pro.
- If you want to determine why your sale or Action Commissions are not generating commissions in Post Affiliate Pro, please first follow the guide for debugging using the Sale requests log.
- Continue reading only if you have already tried the Sale requests log article and discovered that your sale tracking code is not communicating with your installation or your PAP version is older and does not include the Sale requests log option.
When you are certain that your website is not communicating with Post Affiliate Pro—meaning you cannot see any logs in Tools > Sale requests log or in Tools > Event logs—and your clicks are being tracked, it is time to check whether your sale tracking code is actually executing. For this, you will need a browser with developer tools. Most browsers have developer tools that can usually be opened by pressing F12. If you are unsure how to open developer tools in your browser, please consult Google for guidance.
Preparations and Required Knowledge
Make a Click and Get Your Cookie's ID
Click an affiliate link and ensure your click was tracked in Transactions > Clicks list (note that there may be a 5–15 minute delay due to the cron job). While this is not a mandatory step, having a valid cookie and being referred by an affiliate is essential if you want a commission to be saved.
After your click is saved, you can check your browser to find the ID of your cookie. Look for the PAPVisitorID cookie and note its value—it will be a 32-character string of letters and numbers. Copy this ID, go to Tools > Visitor affiliates in your merchant panel, and search for the ID you copied from the cookie. If you find it, you were referred by an affiliate. There should be a record marked as "Actual," which governs how the commission will be saved, under which affiliate, campaign, and so on.
Note down the cookie ID for later use.
Familiarize Yourself with Hashed Names of Your Tracking Scripts
Go to your merchant panel at Tools > Sales/Leads tracking, check the box for "Hash script file names" (if it is not already checked), and note the names of the scripts. We are interested in the strings of letters and numbers immediately following /scripts/, as shown in the screenshot:
From the screenshot, we can see that the hashed variants are 3j05xk1 and 3s05xk1. Note these two, and observe that they differ by just one letter—"j" and "s." Now, we need to get a third script name using "r" instead; in this example, it would be 3r05xk1.
Remember that this string will be different for each user, but all will contain either "j", "s", or "r" as the distinguishing character.
Proceed with the Actual Order
Proceed with a purchase on your website. Before completing the order process, open the developer tools in your browser (usually by pressing F12), and go to the Network tab, where you can see which URLs are called when a page is loaded. Enable persistent/recording mode in the developer tools so that the log is not discarded and continues recording even if you are redirected to another domain.
With the developer tools open and switched to the Network tab, finish the order so that you are redirected to the thank you page, where your sale tracking code should execute.
After the thank you page loads, you should see in the developer tools that a request to your Post Affiliate Pro installation has been made. The request should be made to one of these scripts:
- track.php (or its hashed counterpart, which uses "r" in its name, e.g., 3r05xk1)
- sale.php (or its hashed counterpart, which uses "s" in its name, e.g., 3s05xk1)
Note that you might see a call to track.php (or its hashed counterpart, e.g., 3r05xk1) being made twice. This script is used for both click tracking and sale tracking, so if both codes are present on your thank you page, it could be called twice. The only way to differentiate between them is to copy the full URL with all parameters
and check whether the called URL contains a string such as "sale=".
Click tracking call example:
https://demo.postaffiliatepro.com/scripts/3r05xk1?visitorId=270894e71bef89a0a33e6150cb91Ttl2&accountId=default1&tracking=S&url=H_localhost%2Ftest%2Fsale.html&referrer=H_localhost%2Ftest%2Fhome.html%3Fa_aid%3Dtestaff&getParams=&anchor=&isInIframe=false&cookies=
Sale tracking call example (note the sale= parameter):
https://demo.postaffiliatepro.com/scripts/3r05xk1?visitorId=270894e71bef89a0a33e6150cb91Ttl2&accountId=default1&tracking=S&url=H_localhost%2Ftest%2Fsale.html&referrer=H_localhost%2Ftest%2Fhome.html%3Fa_aid%3Dtestaff&getParams=&anchor=&isInIframe=false&sale=%5B%7B%22ac%22%3A%22%22%2C%22t%22%3A%22120.50%22%2C%22o%22%3A%22ORD_12345XYZ%22%2C%22p%22%3A%22test%20product%22%7D%5D&cookies=
- If you see such a call in your developer tools with status 200 OK, you can be confident that the request is being sent to PAP. You should then see it in Tools > Sale requests log and Tools > Event logs (if logging is enabled).
- If you do not see the call in developer tools, try opening the source code of the thank you page (right-click on the page and select "View page source" or press Ctrl+U), and search the source code using Ctrl+F. Search for any of the following queries:
- pap_
- sale.Set
- sale.php
- /scripts/
Click tracking will also contain pap_, but it will not appear as the sale tracking code. If any of the searches yield a result, ensure it is the sale tracking code.
Even if you see the code on the page, it does not necessarily mean it is executed. Several issues in the added code could prevent it from running:
- Incorrect URL address in the script, not pointing to your PAP instance
- Typo in the code, or the inclusion of a <p> tag or CDATA tags in the code
- Code added outside the <body> section
The goal is to find the code you have used and compare it with the code in your merchant panel at Tools > Integration > Sale/lead tracking to identify the problem. Fix the code and double-check by reloading the thank you page (if your shop allows it), or, preferably, by placing a new order.
When the Request is Executed but the Commission is Not Saved
The easiest option is to check the Tools > Sale requests log and try to identify the reason using the list of most common error messages.
If you cannot use this option or want to find more details about how the commission was saved, you can use either direct debugging or debugging with event logging.
Direct Debugging
Direct debugging requires you to complete the steps above to capture the request URL and add the &PDebug=Y parameter to it (note: debugging via this parameter must first be enabled under Configuration > Event logging!).
Example of track.php (or its hashed variant) with PDebug=Y:
https://demo.postaffiliatepro.com/scripts/3r05xk1?visitorId=270894e71bef89a0a33e6150cb91Ttl2&accountId=default1&tracking=S&url=H_localhost%2Ftest%2Fsale.html&referrer=H_localhost%2Ftest%2Fhome.html%3Fa_aid%3Dtestaff&getParams=&anchor=&isInIframe=false&sale=%5B%7B%22ac%22%3A%22%22%2C%22t%22%3A%22120.50%22%2C%22o%22%3A%22ORD_12345XYZ%22%2C%22p%22%3A%22test%20product%22%7D%5D&cookies=&PDebug=Y
Example of sale.php (or its hashed variant) with PDebug=Y:
https://demo.postaffiliatepro.com/scripts/3s05xk1?AccountId=default1&TotalCost=120.50&OrderID=ORD_12345XYZ&ProductID=test_product&PDebug=Y
When you open the request URL with &PDebug=Y in your browser, it will display logs detailing the entire process of saving the commission. Read the messages line by line to understand how the affiliate and campaign were selected, what may have amended the commission, and so on. For explanations of stopping messages, consult the list of most common error messages.
Debugging with Event Logs
Before placing a test order, go to your merchant panel and navigate to Configuration > Event logging. Check the box for "Sales" and save to enable logging. Now, make a test sale and then turn debugging off. If you are using a cron job on your server (hosted customers always are), it will take 5–15 minutes before the logs are populated. You can speed this up by forcing the tracking requests to process.
Then, navigate to Tools > Event logs, and in the upper left corner, under Search in, select Sale debug. The screenshot below highlights the most important elements:
Each commission saving starts with "Saving sale/action" and contains the request that was sent, including the order ID, for which you can search directly using the search box. When you find a result that starts with "Saving sale/action", copy its Group ID (if you do not see it, you need to Edit view and add the column to your view), then search for this Group ID—it will list all logs related to saving that particular commission. Read through all the messages to understand how the commission was saved and to identify any issues. Consult the list of most common error messages as needed.