Magento Integration Guidelines

Integrating your Incentivit referral program with Magento is simple. Here is a step-by-step tutorial to setup and integrate Incentivit into your Magento store and track referrals.

 

Scripts Integration

Setting up your referral program

If not already done, setup your referral program through your Incentivit account. Incentivit has an easy-to-use step-by-step wizard to facilitate your referral program configuration.

When integrating your Incentivit referral program to your Magento website, you need to implement the following 3 different scripts.

 

1. Ambassador dashboard script

This script allows you to display our widget on your Magento store so your customers can register to your referral program and share with their friends. Note that you can bypass the Register/Login widget page and automatically redirect users to the widget ambassador’s dashboard page, see Scenario #1 for details.

 

Scenario #1 – widget displayed as an iframe on dedicated page

 

 

Scenario #2 – widget displayed as a popup site wide

  • Locate the footer template located here:
app/design/frontend/{ThemeName}/default/template/page/html/footer.phtml

Make sure to use the right {ThemeName}, especially if you are not using the default Magento theme.

  • Copy and paste the “popup” script located in your Incentivit account under Integration tab (Advocates Widget script)of your referral program in the footer section of your Magento website.

 

 

 

 

2. Referrals tracking script

This script keeps track of referrals landing on your Magento store after clicking a url shared by your ambassadors.

Copy and paste the javascript tracking code located in your Incentivit account under Integration tab (Referrals Widget script) of your referral program on the Referral redirect url of your Magento store. You can find the Referral redirect url under the referral page located under the Configuration tab of your referral program.

 

 

 

3. Conversion Tracking script

This script tracks conversion (purchases) of customers referred by your ambassadors. This script should be placed in the order success confirmation page.

 

This is should be located in the following path:

app/design/frontend/{ThemeName}/default/template/checkout/success.phtml

 

Make sure to use the right {ThemeName}, especially if you are not using the default Magento theme.

Append the php code below anywhere towards the end of the file. Your tracking conversion script already contains your [YOUR PROGRAM_ID] and [YOUR KEY] so just make sure to use your own Tracking Conversion Script as a basis for the code below.

<?php
 //Get order ID
 $order_id = $this->getOrderId();
 //Get the order
 $order = Mage::getModel('sales/order')->load($order_id);
 //Get the order total
 $order_total = round($order->getGrandTotal(), 2);

$customer = Mage::getModel('customer/customer')->load($customerId);;
 //Get the customer's email address
 $email = $order->getCustomerEmail();
 //Get the customer's first and last name
 $fname = $customer->getFirstname();
 $lname = $customer->getLastname();
 ?>
 <script id='incentivit-conversion-script' type='text/javascript'>(function () {
 incentivit_program_id = '[YOUR PROGRAM_ID]';
 incentivit_key = '[YOUR KEY]';
 incentivit_referral_email = '<?php echo $email ?>';
 incentivit_referral_fname = '<?php echo $fname ?>';
 incentivit_referral_lname = '<?php echo $lname ?>';
 incentivit_referral_amount = '<?php echo $order_total ?>';
 incentivit_referral_orderId = '<?php echo $order_id ?>';
 var inc_script = document.createElement('script');
 inc_script.type = 'text/javascript';
 inc_script.async = true;
 inc_script.src = 'https://incentivit.com/programs/js/conversion_trckr.js';
 var s = document.getElementsByTagName('script')[0];
 s.parentNode.insertBefore(inc_script, s);
 })();</script>