WordPress Affiliate Manager

Affiliates Management Plugin for WordPress

  • Home
  • Features
    • Screen Shots
  • Download
  • Documentation
  • Addons
  • Support
    • Support Forum
    • Forum Login
    • Forum Registration
    • Contact
    • Premium Addon/Plugin Support

[Resolved] How to Track Affiliate Commissions?

by

WordPress Affiliate Manager › Forums › Affiliate Manager Plugin › How to Track Affiliate Commissions?

Tagged: affiliate, booking, how-to, paypal

  • This topic has 8 replies, 3 voices, and was last updated 8 years, 6 months ago by Group Of Oceninfo.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • July 26, 2017 at 3:53 am #2838
    Group Of Oceninfo
    Participant

    Hello Team,

    Thank you for creating such a great plugin.

    I have installed this plugin and using custom theme where using PayPal functionality for the checkout and landing back on confirmation page with all the booking information. I have setup everything perfectly as required Unique Click Tracking is working fine but when someone is making transaction it’s not getting track. How to find that booking is come through Affiliate or it’s direct booking? Can you please let me know how I can track final booking is by affiliate. Booking confirmation URL = http://www.mywebsite.com/booking-confirmation/?booking_no=12345&pin_code=1234&payment=success&token=EC-4AB61718UC7263555&PayerID=ABCDEFGH7IJKLM

    How Can I trigger below code on booking confirmation URL? So, It’ll track affiliate commission. I have supplied relevant information which will fill dynamically same as $_COOKIE[‘wpam_id’].

    $args = array();
    $args['txn_id'] = $booking_data['booking_no'];
    $args['amount'] = $booking_data['deposit_paid'];
    $aff_id = $_COOKIE['wpam_id'];
    do_action('wpam_process_affiliate_commission', $args);

    Please provide me some code to trigger this value and get this information when someone land on booking confirmation URL.

    FYI >> It’s Free Plugin, Not Using WooCommerce Functionality.

    Thanks,

    July 26, 2017 at 5:26 am #2840
    Group Of Oceninfo
    Participant

    I am using below code to trigger into wpam_process_affiliate_commission but it’s not showing anything into WP Backend.

    if(strpos($_SERVER['REQUEST_URI'], 'accommodation-booking-confirmation/?booking_no') !== false){
    	$args = array();
    	$args['txn_id'] = $booking_data['booking_no'];
    	$args['amount'] = $booking_data['total_price'];
    	$aff_id = $_COOKIE['wpam_id'];
    	do_action('wpam_process_affiliate_commission', $args);
    }

    I have tested using below code and it’s showing correct value into front-end.

    if(strpos($_SERVER['REQUEST_URI'], 'accommodation-booking-confirmation/?booking_no') !== false){
    		$args = array();
    		$args['txn_id'] = $booking_data['booking_no'];
    		$args['amount'] = $booking_data['total_price'];
    		$aff_id = $_COOKIE['wpam_id'];
    		do_action('wpam_process_affiliate_commission', $args);
    	echo "<pre>";
    	print_r($args['txn_id']);
    	echo '<br/>';
    	print_r($args['amount']);
    	echo '<br/>';
    	print_r($aff_id);
    	echo '<br/>';
    	echo 'Booking Confirmed';
    	} else {
    	echo 'Booking Is Not Confirmed';
    }

    Can you please let me know where I am doing wrong? How I can trigger and supply this value into Affiliate Commissions

    July 26, 2017 at 5:28 am #2842
    Shadow Labs
    Keymaster

    Hi, It’s PHP code. You can’t trigger it on an HTML page directly. Does your plugin trigger any action hook or some code once the payment is completed? if so you need to add this code after that.

    July 26, 2017 at 7:12 am #2843
    Group Of Oceninfo
    Participant

    Thank you for your reply, Yup I am adding this code into confirmation page .php file called booking-confirmation.php I have added right after payment confirmation code that’s why it’s picking up value dynamically but not showing any commission into affiliate commission section. Nothing recorded.

    So, How I can supply value in do_action('wpam_process_affiliate_commission', $args);

    July 26, 2017 at 8:42 am #2845
    Group Of Oceninfo
    Participant

    Please see logs wpam-log.txt file record as below.

    [07/26/2017 8:12 AM] - SUCCESS : Affiliate Application for Testing Affiliate Website
    [07/26/2017 8:12 AM] - SUCCESS : Sending an email to [email protected]
    [07/26/2017 8:12 AM] - SUCCESS : Email was sent successfully by WordPress
    [07/26/2017 8:12 AM] - SUCCESS : New Affiliate Registration
    [07/26/2017 8:12 AM] - SUCCESS : Sending an email to [email protected]
    [07/26/2017 8:12 AM] - SUCCESS : Email was sent successfully by WordPress
    [07/26/2017 8:22 AM] - SUCCESS : handle_commission_tracking_hook() - Txn ID : 86796, Amount: 100.90, Affiliate ID: 

    Affiliate ID field is coming up blank, I have cross checked Affiliate ID value is present under cookies.

    I feel if we get affiliate ID from cookies then it’ll sort this out commission tracking issue.

    July 26, 2017 at 10:32 am #2846
    Group Of Oceninfo
    Participant

    Hello All,

    I have found the solution, It was not picking up value from the cookies Code updated under /wp-content/plugins/affiliates-manager/classes/CommissionTracking.php

    From
    //$aff_id = $args['aff_id'];
    To
    $aff_id = $_COOKIE['wpam_id'];

    It’s working smoothly now.

    Thank you,

    July 27, 2017 at 5:15 am #2847
    Shadow Labs
    Keymaster

    CommissionTracking.php is fine. You actually need to retrieve the value of the cookie into an array element before passing it to the function:

    
    $args = array();
    $args['txn_id'] = $booking_data['booking_no'];
    $args['amount'] = $booking_data['total_price'];
    $args['aff_id'] = $_COOKIE['wpam_id'];  //not $aff_id = $_COOKIE['wpam_id'];
    do_action('wpam_process_affiliate_commission', $args);
    
    September 23, 2017 at 6:03 pm #2943
    batoy28
    Participant

    Hello,

    I want to ask how I can set-up affiliate for a booking website?

    I am using this WP theme http://help.wprentals.org/. It is a rental booking theme. Think of it like an AirBnB, Agoda or Booking.com

    Unfortunately, it seems it does not support affiliate program.

    Please help.

    Thanks

    September 25, 2017 at 5:25 am #2947
    Group Of Oceninfo
    Participant

    I think you are using this theme http://wprentals.org/ you can track affiliate easily using this plugin on any WordPress theme.

    You have to use below code on your thank you page where $booking_data[‘booking_no’], $booking_data[‘total_price’]; value will be changed according to your theme parameter.

    Supply booking no and total price value dynamically from the thank you page after booking, It’ll take affiliate ID dynamically via cookies value, so leave aff_id code as it is.

    $args = array();
    $args['txn_id'] = $booking_data['booking_no'];
    $args['amount'] = $booking_data['total_price'];
    $args['aff_id'] = $_COOKIE['wpam_id'];  //not $aff_id = $_COOKIE['wpam_id'];
    do_action('wpam_process_affiliate_commission', $args);

    After supplying this code on thank you page with all the value then you can track affiliate booking easily and affiliate can also see the booking in affiliate dashboard.

    FYI>> It won’t work if you are sending user to book on third party website.

  • Author
    Posts
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.
Log In

Featured Addons

  • WooCommerce Coupon Tracking
  • WooCommerce Product Specific Commission

Copyright © 2026 | WordPress Affiliate Manager | Privacy Policy