WordPress Affiliate Manager › Forums › Affiliate Manager Plugin › How to Track Affiliate Commissions?
- This topic has 8 replies, 3 voices, and was last updated 8 years, 6 months ago by
Group Of Oceninfo.
-
AuthorPosts
-
July 26, 2017 at 3:53 am #2838
Group Of Oceninfo
ParticipantHello 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=ABCDEFGH7IJKLMHow 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 #2840Group Of Oceninfo
ParticipantI 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 #2842Shadow Labs
KeymasterHi, 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 #2843Group Of Oceninfo
ParticipantThank 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 #2845Group Of Oceninfo
ParticipantPlease 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 #2846Group Of Oceninfo
ParticipantHello 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 #2847Shadow Labs
KeymasterCommissionTracking.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 #2943batoy28
ParticipantHello,
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.comUnfortunately, it seems it does not support affiliate program.
Please help.
Thanks
September 25, 2017 at 5:25 am #2947Group Of Oceninfo
ParticipantI 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.
-
AuthorPosts
- You must be logged in to reply to this topic.