Affiliate attribution via javascript
Ususally it's enough to just add the tracking code to your salespage as found in the Digistore backoffice under: Settings - Promocode for Salespage
The code is e.g.:
<script src="https://www.digistore24-scripts.com/service/digistore.js"></script>
<script type="text/javascript">
digistorePromocode( { "product_id": 12345, "adjust_domain": true } );
</script>
12345 is the id of your product.
The js code modifies all regular A-HREF-Links and append the affiliate to the url.
Example:
Salespage url is: https://www.some-domain.com/salespage/
Checkout button on the sales page is:
<a href='https://www.checkout-ds24.com/product/12345'>Buy now</a>
The affiliate advertizes: https://www.some-domain.com/salespage/?aff=some_affiliate_name
When a buyer follows the affiliate's link, then the js code above changes the checkout button url to: https://www.checkout-ds24.com/product/12345?aff=some_affiliate_name
That's the regular workflow.
However, if you use a custom js button like:
<a onclick="windows.open('https://www.checkout-ds24.com/product/12345')">Buy now</a>
Then our js cannot identify this button and cannot append the affiliate.
The solution is to use our js function: digistoreAppendAffiliateToUrl
( string url ) : string
This function appends the affiliate to an url.
In this case use a button like:
<a onclick="windows.open( digistoreAppendAffiliateToUrl( 'https://www.checkout-ds24.com/product/12345') )">Buy now</a>