Generic referral tracking script
If you wish to track referrals for successful conversions of custom success pages, the
[affiliate_conversion_script] shortcode allows you to track affiliate referral links and generate referrals on successful conversions by placing it on your "success" page.
When a visitor comes to your site via an affiliate link and successfully makes it through your checkout, signup form, or any other conversion process, this shortcode will generate a referral record for the affiliate whose link was clicked.
[affiliate_conversion_script] should be placed on your success page (the page visitors land on after completing their purchase or signup). The shortcode accepts several parameters that allow you to define the various values for the referral generated:
- amount - The purchase amount that the referral should be based on. This is the total purchase amount, not the total referral amount. The referral amount will be calculated based off of the referral rate for the affiliate. If you are using a flat referral rate, make sure to set an amount greater than zero for the amount parameter, otherwise only zero-amount referrals will be created.
- description - A description logged with the referral.
- context - A context for the referral. You will want to use this if you have multiple purchase or signup forms.
- reference - A unique reference variable for the affiliate. This could be the user ID of the new user (if they are signing up for your site) or a transaction ID.
- status - The status to give the referral. By default, referrals created with this short code will be set to "pending". Valid options are: "pending", "unpaid", "paid", and "rejected".
- type - As of version 2.2 of AffiliateWP, referral types were introduced. By default the type will be set to "sale". Valid options are: "sale", "opt-in", and "lead".
An example using all of the parameters above:
[affiliate_conversion_script amount="10" description="My Description" context="Contact Form" reference="1234" status="pending" type="opt-in"]
Important information for using this shortcode — please read:
- Usage: The [affiliate_conversion_script] shortcode can be used on multiple success pages, but a referral cannot be generated again until cookies are cleared/expired.
- Formatting: Ensure you leave spaces between the script parameters as seen in the above example, otherwise you will have blank entries, including a zero amount when the referral is created.
- Coupons: The [affiliate_conversion_script] shortcode does not support coupon usage of any type; for example, if your customers are using discount/coupon codes to purchase products, this will not have any effect on the referral amount awarded to the affiliate, when using this shortcode. The referral amount will only be calculated based on the amount entered inside the [affiliate_conversion_script] shortcode (see the amount parameter above for more information). If you would like discounts and coupons to affect affiliate referral amounts, please consider using one of our supported integrations.