Integrate SendOwl Products with AffiliateWP

In this guide, we will show you how to connect your SendOwl account with AffiliateWP plugin as well as walking through all features provided by our extension.

Requirements:

SendOwl Configuration

  1. Install and activate plugins
  2. Connect to SendOwl account
  3. Add a redirect URL

1. Install and activate plugins

First of all, you need to install and activate our integration extension on the site where AffiliateWP plugin is installed.

Then go to Affiliates >> Sendowl and enter your license key available in the purchase email.


2. Connect to SendOwl account

After that, add the following code snippet to your wp-config.php file to connect the site with your SendOwl account.

define('AFFILIATE_WP_SENDOWL_KEY', 'your-sendowl-key');
define('AFFILIATE_WP_SENDOWL_SECRET', 'your-sendowl-secret');

Replace your-sendowl-key and your-sendowl-secret with your actual API key information. You can find them under SendOwl Settings >> Advanced >> API page. If you have no existing key, click on “Add API key” button to generate a new one.

3. Add a redirect URL

Finally, you’re required to insert a redirect URL into your SendOwl product to track referrals after successful conversions. When someone purchases your products, SendOwl will send a record to our extension who will credit your affiliate with a commission if any.

You can achieve this by creating a global or product level redirect.

  • The global, or account level redirect means that your customers will be redirected to the same link after any product purchase.
  • Product level redirect allows you to set different redirect URLs for different products.

In either case, navigate to “Redirect URL” field.

Then add the following code:

https:/your-website.com/wp-json/affwp-sendowl/v1/callback?order_id={{ order.id }}&amount={{ order.settled_gross }}&email={{ order.buyer_email }}&download_url={{ order.download_url }}&desc={{ order.cart.cart_items[0].product.name }}

Don’t forget to change https:/your-website.com to your actual website address.

The recorded information includes:

  • Order ID
  • Product Price: the total amount charged
    • In case of Product, change settled_gross to price_at_checkout if you want to calculate commission based on the original price instead of which after discount.
  • Buyer email
  • Referral Description: Display SendOwl order ID and coupon code under Reference column on AffiliateWP >> Referrals page

Product Specific Rates

To set the different referral rates for each SendOwl product, you only need to add “rate” value to the redirect URL.

https:/your-website.com/wp-json/affwp-sendowl/v1/callback?order_id={{ order.id }}&amount={{ order.settled_gross }}&email={{ order.buyer_email }}&download_url={{ order.download_url }}&desc={{ order.cart.cart_items[0].product.name }}&rate=x

Replace x by the referral rate which you want to apply for this product, e.g rate=30. So if a customer buys this product, your affiliate will be rewarded a referral with amount equalling 30% of the product price.

Affiliate Coupon Tracking

To enable affiliate coupon tracking, you need to complete 2 steps below:

  1. Create a SendOwl coupon code
  2. Assign coupon to specific affiliate

1. Create a SendOwl coupon code

Please refer to Using Discount Codes for instruction on how to generate a custom coupon code with SendOwl.

It’s possible to set or include your affiliate’s username as part of the custom coupon code.

2. Assign coupon to specific affiliate

Go to edit the affiliate to who you want to assign coupon in AffiliateWP >> Affiliates page. You will see a new “SendOwl Coupons” field when scrolling down to the bottom of the editor page.

Simply add the coupon code to this field with format: coupon-code__rate

Please note that:

  • Rate type always is percentage.
  • One affiliate can have multiple coupon codes separated by a space.

Once you save the changes, a new Coupons tab will be added to this affiliate dashboard like the image below:

Every time the customers use this code to purchase your products, the connected affiliate will be rewarded a referral.

Please note that:

  • Coupon code is assigned to one affiliate only. As a result, you won’t be able to add the same coupon code to more than two affiliates.
  • If you add a coupon with an empty “rate”, e.g. e9f89da6464__, our plugin will assign the rate value set in redirect URL (1) or global (default) referral rate (2) to this affiliate.
  • If a coupon is removed from your SendOwl account, it will display as “invalid coupon” in the corresponding affiliate’s dashboard.
    • Expired coupons will still display as normal. You should manually remove them or notice your affiliates once a coupon expires either by usage or time.

Cross-Site (Domain) Tracker

This feature enables you to redirect AffiliateWP referral links to a specific sale page hosted elsewhere without installing any extra plugin to connect them.

Let’s say:

  • SiteAWP.com is where you installed AffiliateWP plugin and our extension. AffiliateWP cookies will be stored on this site too.
  • SiteSale.com is where the sale (conversion) takes place. You don’t need to install any plugin on this site.

Once a customer accesses your referral link, which is something like http://siteAWP.com/?ref=123, they will be auto redirected to siteSale.com where they can view and buy your products. At the same time, our plugin will store the affiliate ID and visit ID to siteAWP.com, which helps to convert a visit to referral once the customer process the purchase successfully.

In order to achieve this, you’ll just need to edit the wp-config.php and add the following code:

define('AFFILIATE_WP_SENDOWL_REDIRECTS', array(
      'home'     => 'https://siteSale.com',
));

It’s important to know that the redirect function will not work if an affiliate tries to access his own referral link after logging to the affiliate account. This is because AffiliateWP doesn’t allow affiliates to earn commission on their own purchases by default.

Set up Specific Landing Pages

In some cases, you might want to redirect users to some specific high-converting landing pages. In other words, your affiliates are able to choose which URLs their audience will first see when accessing your e-commerce site.

First, you will need to define your landing pages by adding the following code into your wp-config.php.

define('AFFILIATE_WP_SENDOWL_REDIRECTS', array( 
   'pricing'  => 'https://siteSale.com/pricing',
   'features' => 'https://siteSale.com/features',
   'home'     => 'https://siteSale.com'
));

The “home” URL is required while other pages such as Features and Pricing page can be removed or added.

Second, you will need to show these landing pages on your affiliate’s dashboard.

1. Copy the AffiliateWP “dashboard-tab-urls.php” template into your child theme as follows:

2. Open the file and replace the <input> with the <select> HTML tag as follows:

<!--<input type="text" name="url" id="affwp-url" value="<?php echo esc_url( urldecode( affwp_get_affiliate_base_url() ) ); ?>" />-->
<select name="url" id="affwp-url">
	<option value="https://siteAWP.com/">Homepage</option>
	<option value="https://siteAWP.com/features/">Features page</option>
	<option value="https://siteAWP.com/pricing/">Pricing page</option>
</select>

This will replace the default AffiliateWP input field with a dropdown under the affiliate’s dashboard as per the screenshot below.

Each dropdown option will be connected to a referral link you setup above. For example, selecting the “Features page” will generate a referral URL like https://siteAWP.com/features/?ref=123. And when someone accesses this link, they will see the https://siteSale.com/features at first.

Lasted updated on January 20, 2020