Jump to content
  • 0

Handling referrals with a separate site for marketing?


sunrisepro
 Share

Question

I'm wondering how to best handle affiliate referrals. I have my business website (WP), and I use Blesta for sales, payments, & tickets. I don't have any static pages on Blesta aside from order forms; all of my marketing content is on my main website. I'd like to use Blesta's referral system for a new recurring service product, rather than build out subscriptions & referrals based on Woocommerce (and thus have 2 separate billing options). 

Since referrals would need to land on Blesta to be counted as a referral, do I need to make static marketing pages on Blesta to receive the traffic? Or is there some miracle workaround where someone landing on WP can be counted by Blesta as an affiliate? (I realize this last question might be rather dumb...)

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0
On 12/31/2020 at 8:59 AM, sunrisepro said:

I'm wondering how to best handle affiliate referrals. I have my business website (WP), and I use Blesta for sales, payments, & tickets. I don't have any static pages on Blesta aside from order forms; all of my marketing content is on my main website. I'd like to use Blesta's referral system for a new recurring service product, rather than build out subscriptions & referrals based on Woocommerce (and thus have 2 separate billing options). 

Since referrals would need to land on Blesta to be counted as a referral, do I need to make static marketing pages on Blesta to receive the traffic? Or is there some miracle workaround where someone landing on WP can be counted by Blesta as an affiliate? (I realize this last question might be rather dumb...)

Sorry for the super slow reply. The referral links that Blesta generates will create a cookie on the client's computer. If you want to instead direct affiliates to link to another page than the one the affiliate link directs to you: For example: http://domain.com/order/forms/a/MQ== You could write your own script and link to another page, e.g. http://domain.com/hosting.php?a=MQ== and take the value of $_GET['a']; which is MQ== (In my example, it will be different for each of your affiliates) and assign it to a cookie called affiliate_code

Blesta will check for this affiliate_code cookie, so if you create it by another means, and assign the correct value to it, it'll still work.

Link to comment
Share on other sites

  • 0

I am using some Javascript to add the affiliate ID to every link on my main site, so it passes the affiliate ID when they click an order button that links to Blesta. I've tried creating a cookie named affiliate_code, but it seems to have issues across domains or with subdomains, so I'm not sure it's working well yet.

I also added a fetch so that the visit counts towards the affiliate's visit count in their stats.

Code I add in the header, if anyone wants to try and use it:

<script>
	function getParameterByName(name, url) {
		if (!url) url = window.location.href;
		name = name.replace(/[\[\]]/g, '\\$&');
		var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
			results = regex.exec(url);
		if (!results) return null;
		if (!results[2]) return '';
		return decodeURIComponent(results[2].replace(/\+/g, ' '));
	}
	window.addEventListener('load', function() {
		var anchors = document.getElementsByTagName("a");
		let affiliate_id = getParameterByName('a');
		if (affiliate_id !== null ) {
			let blestadomain = '.yourdomain.com';
			let daystoexpire = 60;
			const d = new Date();
			d.setTime(d.getTime() + (daystoexpire*24*60*60*1000));
			document.cookie = "affiliate_code=" + affiliate_id + "; expires=" + d.toUTCString() + "; ;domain=" + blestadomain + ";path=/";
			console.log('Set cookie - affiliate ID: ' + affiliate_id + '; expires: ' + d.toUTCString() + '; domain: ' + blestadomain);
			for (var i = 0; i < anchors.length; i++) {
                anchors[i].href = anchors[i].href.indexOf('#') != -1 ? anchors[i].href : anchors[i].href += anchors[i].href.indexOf('?') != -1 ? "&a=" + affiliate_id  : "?a=" + affiliate_id;
            }
			fetch('https://billing.yourdomain.com/order/forms/a/' + affiliate_id, { mode: "no-cors" });
		}
	});
</script>

EDIT: Changed window.load to window.addEventListener because window.load was unreliable on some sites for some reason.

Link to comment
Share on other sites

  • 0
On 2/12/2021 at 1:08 PM, Paul said:

Sorry for the super slow reply. The referral links that Blesta generates will create a cookie on the client's computer. If you want to instead direct affiliates to link to another page than the one the affiliate link directs to you: For example: http://domain.com/order/forms/a/MQ== You could write your own script and link to another page, e.g. http://domain.com/hosting.php?a=MQ== and take the value of $_GET['a']; which is MQ== (In my example, it will be different for each of your affiliates) and assign it to a cookie called affiliate_code

Blesta will check for this affiliate_code cookie, so if you create it by another means, and assign the correct value to it, it'll still work.

Is there any way you all could build something into the system that would allow our affiliates to set a landing page? I have included a screenshot of how that might look on the affiliate's side based on an affiliate program I use on my non-hosting sites.  

Affiliate Landing Page Suggestion.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...