Magento
Integrating your Referral Rock program with Magento is simple. We'll go step-by-step through the setup needed to track referral purchases.
Setting up the Referral Redirect Page
- Navigate to Program Editor > Share or click here
- Under Referral Destination, select Change Destination
- Make sure the Webpage Redirect option is selected and enter the URL to the page where your Gravity Form is hosted.
Referral Conversion Tracking in Magento
The next step in setting up Referral Rock to work with Magento is tracking conversions on your store. This will tell us which referral purchased from your store, the dollar value of their purchase, and who the member was that referred them so that you can reward that member. We'll be using a small snippet of custom PHP to track customer checkouts.
-
Navigate to your Magento Source Code.
-
Find the following file: [Magento root path]/app/design/frontend/base/default/template/checkout/success.phtml.
-
Append your Magento Event Script (example below) anywhere towards the end of the file.
-
Replace [YOUR REFERRAL ROCK URL] with your unique Referral Rock Postback URL. It can be found here.
-
Save the file.
Your Postback URL should look like the following: https://yourbusinessname.referralrock.com/webcallback/
Magento Example Event Script
<?php //Get the last order ID $order_id = Mage::getSingleton('checkout/session')--->getLastOrderId(); //Get the order $order = Mage::getModel('sales/order')->load($order_id); //Get the grand total $grand_total = round($order->getGrandTotal(), 2); //Get the customer's email address $email = $order->getCustomerEmail(); //Get the customer's name $name = $order->getCustomerName(); //Construct the tracking pixel $RRPixelString = '<img src="//[YOUR REFERRAL ROCK URL]?refid='.$order_id.'&name='.$name.'&email='.$email.'&amount='.$grand_total.'" height="1" width="1">';?><?php echo $RRPixelString ?>Updated about 1 year ago