The Lightweight Affiliate Tracking Add On for Paid Memberships Pro creates unique affiliate codes assigned to your affiliate users. When someone visits your site using an affiliate URL (a code is passed to a page as a parameter), the affiliate’s cookie is set for the specified number of days. If a cookie containing an affiliate referral code is present after checkout, the order is logged in the affiliate’s account.
Affiliates can see a report of their activity by creating a page with the shortcode
pmpro_affiliates_report (optional). The admin can view a report of affiliate activity in the admin under Memberships > Affiliates as well as add and manage affiliate codes.
- PMPro Plus members can install the add on from the Memberships > Add Ons admin page.
- Or, download the plugin and upload the ‘pmpro-affiliates’ directory to the ‘/wp-content/plugins/’ directory of your site.
- Activate the plugin through the ‘Plugins’ menu in WordPress.
View Affiliates or Set Up a New Affiliate
Admins can view active affiliates under the Memberships > Affiliates admin page.
To Set Up a New Affiliate
- Navigate to Memberships > Affiliates in your WordPress admin.
- Click “Add a New Affiliate”.
- This form contains the following fields/settings:
- ID: (this will be generated when you save.)
- Code: This will be generated or you can override with your own custom Affiliate Code. This is the value added to the site URL to designate the affiliate link. (e.g. “&pa=CODE” or “?pa=CODE”).
- Business/Contact Name: A custom contact name for the affiliate (not shown publicly).
- Affiliate User: The username of a WordPress user in your site who should have access to affiliate reports.
- Tracking Code: If you are tracking this affiliate through another system, you can add HTML/JS code here to run on the confirmation page after checkout. Variables: !!ORDER_ID!!, !!LEVEL_NAME!! (Optional)
- Cookie Length: Length of time the cookie will remain valid for the affiliate tracking. Default is 30 days.
- Enabled: Yes or No
Automatically Generate an Affiliate Code after Membership Checkout
You can now generate an Affiliate Code for your members as part of their membership checkout (instead of having to manually create the affiliate).
- Navigate to Memberships > Membership Levels.
- Edit a Membership Level.
- Check the box labeled “Check this if you want to automatically create the affiliate code for members of this level” under the “Affiliate Settings” heading.
- Save the level.
All new members that complete a checkout for this level will have an Affiliate Code generated for them. Note that existing members of this level will NOT automatically be entered into your affiliate program.
Frontend “Report” View for Affiliates
Allow members with an Affiliate Code to view their affiliate URL and see a history of activity on their affiliate URL. A link to this report page is automatically added to the “Member Links” section of the Membership Account page.
The Member’s report page can be created via two methods:
- Navigate to Memberships > Page Settings. Here you will see a new setting for the “Affiliate Report” page. Click the link to generate the page.
- Or, add a new page yourself and include the shortcode
pmpro_affiliates_report. Then, assign your newly created page as the “Affiliate Report” page under Memberships > Page Settings.
- Use shortcode attributes (outlined below) to customize what user fields are visible to your Affiliate on the frontend report.
Frontend Report Shortcode Attributes
Example shortcode with attributes:
[pmpro_affiliates_report back_link="0" export="0" fields="membership_level,total" help="1"]
- back_link: Hide or show the link back to view the Membership Account from the frontend report page. Default: true; Accepts true or false.
- export: Allow the Affiliate user to download a .csv export of signups using their code. Default: true; Accepts true or false. Note that the export will include full user details, including the affiliate code used, user_id, user_login, display_name, membership_level, date, and order total.
- fields: Adjust what user identitying field are shown on the frontend report. Options include affiliate code used, user_id, user_login, display_name, membership_level, date, and order total. Default: all fields; Accepts: any comma-separate list of the included fields.
- help: Hide or show a helper section that allows the shows the affiliate how to generate custom links to landing pages in your site with their appended Affiliate code. Default: true; Accepts true or false.
View Affiliate Reports as Admin
Navigate to Memberships > Affiliates to view reports of activity for your affiliate codes. You can view a report of all affiliate activity or the activity of a specific affiliate’s code.
Rename the term “Affiliates” for Your Program
You can globally replace the term “Affiliates” throughout the tracking system to any term (singular and plural) of your choice. This is useful if you would like to repurpose the Affiliates Add On for “Referrals” or “Invitations”.
To update the term, navigate to Memberships > Affiliates > Settings. Specify your new Singular Name and Plural Name. Then click to save.
- This plugin does not handle any payouts to your affiliates.
- If you plan to award affiliates, you can download a report (CSV) of affiliate activity and process the payments manually on a monthly, quarterly, etc. basis.
- This plugin does not deduct the “sale” from the affiliate when a member cancels.
- This plugin does not log recurring sales for the referring affiliate.
Action and Filter Hooks
The following actions and filters are available in this Add On:
do_action( 'pmpro_affiliate_after_settings' );
apply_filters( 'pmpro_affiliates_new_code', $code );
apply_filters( 'pmproaf_default_cookie_duration', $days = 30, $user_id, $pmpro_level )