Chargebee Payment Links
You use Chargebee Payment Links on your website
Step 1: Tracking Clicks
Insert the following script in your website's <head>
tag to start tracking clicks:
Normal Method
<script
src="https://pushlapgrowth.com/affiliate-tracker.js"
data-affiliate
data-program-id="YOUR_AFFILIATE_PROGRAM_ID"
async>
</script>
Using Google Tag Manager
<script>
var pushLap = document.createElement('script');
pushLap.src = "https://pushlapgrowth.com/affiliate-tracker.js";
pushLap.setAttribute('data-affiliate', '');
pushLap.setAttribute('data-program-id', 'YOUR_AFFILIATE_PROGRAM_ID');
document.head.appendChild(pushLap);
</script>
Step 2: Create a custom field in Chargebee
Create a custom field in your Chargebee dashboard by going to Settings -> Configure Chargebee -> Custom Fields -> Customer -> Single line text
Give it a value of
Label: pushlap_affiliate_id
API Name: cf_pushlap_affiliate_id
Step 3: Send Affiliate ID Chargebee
Add this script to the page where users click the chargebee payment link. Make sure the script in step 1 is also available on this page. Please add this script at the bottom of your website before the closing </body> tag:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
setTimeout(function() {
const affiliateId = window.affiliateId;
// Handle Chargebee URLs
$('a[href*="chargebee.com"]').each(function() {
const oldUrl = $(this).attr("href");
if (!oldUrl.includes("customer[cf_pushlap_affiliate_id]")) {
const separator = oldUrl.includes("?") ? "&" : "?";
const newUrl = oldUrl + separator + "customer[cf_pushlap_affiliate_id]=" + encodeURIComponent(affiliateId);
$(this).attr("href", newUrl);
}
});
}, 2000);
});
</script>
Step 4: Create and setup Webhook to track sales
Create a new endpoint for Chargebee to send events to. You can do this in your Chargebee dashboard by going to Settings -> Configure Chargebee -> Webhooks -> Add Webhook
Webhook Name: Push Lap Growth Integration
Webhook Endpoint: https://www.pushlapgrowth.com/api/webhooks/chargebee?program_id=fc96bb84-278c-4b44-bcd1-9ec9fb816505
API Version: Version 2
Choose the following events:
Subscription Created
Subscription Started
Subscription Activated
Subscription Cancelled
Subscription Deleted
Payment Succeeded
Payment Refunded
Enable the option: "Exclude card information from webhook call"