SamCart integration
SamCart integration allows you to track the regular (one time) orders and also recurring payments. The integration consists of adding a tracking code to each product advanced settings and creating a webhook which will notify a plugin in your Post Affiliate Pro.
To track recurring payments you need to use the Recurring Commissions feature!
Create a custom field
The first step in this integration is to create a custom field which will be used for carrying the tracking cookie. If you need more info about how to achieve this, see the SamCart documentation about custom fields.
When creating it, make sure to set the Internal Field Name to “papCookie” and set Field Type to Text Input. Everything else may remain default.
When your custom field is created save the ‘Slug’ value as you will need it in the next step. Now add the custom field to all of the products that you want to track by Post Affiliate Pro.
Add tracking code
The next step would be to add the sale tracking code. Navigate to your SamCart Settings. Find General Settings and paste the following code into the Embed HTML/Scripts field:
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">
var slugId = 'XXXXXXXX';
document.getElementById(slugId).parentNode.parentNode.style.display = 'none';
try {
PostAffTracker.setAccountId('Account_ID');
PostAffTracker.track();
setTimeout(function(){
PostAffTracker.writeCookieToCustomField(slugId);
}, 1000);
} catch (err) { }
</script>
Make sure to replace the value XXXXXXXX with your custom slug of your custom field.
Create the integration
Still under SamCart Settings go to the Integrations menu and under the Integration Setup tab click the New Integration button. From the dropdown select the Notify URL integration, on the next window name it as you like and insert the following Notify URL.
Make sure to replace the SHOPNAME.samcart.com with the actual URL of your SamCart shop:
https://URL_TO_PostAffiliatePro/plugins/SamCart/samcart.php?accountId=Account_ID&shopUrl=SHOPNAME.samcart.com
Create the rules
Under SamCart Settings > Integrations switch to Global Rules tab and create 2 new rules for triggers Product Purchased and Subscription Charged, in both rules make sure to select the integration you’ve created and the action to Send Notify Url POST.
If you wish to track also refunds and automatically refund the commissions add also a rule for triggers Product Refunded and Subscription Charge Refunded and don’t forget to enable the refund tracking in the plugin configuration in the next step.
Activate the SamCart plugin in PAP
Log in to your Post Affiliate Pro merchant panel and navigate to Configuration > Plugins section and activate the SamCart webhook handling plugin. Once the plugin is activated make sure to configure it, mainly enter your Shop URL as the same value which you’ve added in the previous step.
Add the custom field to products
The last step is to add the custom field you’ve created in previous step to all the products which should be tracked by Post Affiliate Pro. To do this, in your SamCart dashboard navigate to Products and edit each product.
In the product edit view go to the Checkout Design section and scroll down to EDIT YOUR PAGE section and click on the Launch Drag & Drop Builder button. On the next screen go to the Settings > Checkout Form and under Custom Fields section check the checkbox next to the papCookie custom field and save the product by clicking the Publish button at the top of the page.
Discover seamless Ubercart integration with Post Affiliate Pro! Our guide offers step-by-step instructions and code snippets for integrating Ubercart and PayPal, enhancing your Drupal-powered online store. Start your free trial today and boost your e-commerce success with Post Affiliate Pro's user-friendly affiliate marketing software.