renderJsTrackingCode
Syntax
renderJsTrackingCode(
affiliate_name='',
campaignkey_name='',
trackingkey_name='',
callback=''
)
Creates a JavaScript code that reads the current affiliate, campaign
key and tracking key on a landing page and stores them e.g. in hidden
inputs.
Returns a JavaScript code that is built into your website. You can get the code manually here.
On your page you add INPUT and the tracking code e.g.:
<script src="https://www.digistore24.com/track_info/123/abcdef.js?affiliate=my_affiliate"></script>
<form>
<input name="my_affiliate" type="hidden" />
</form>
The input is then automatically updated with the affiliate name.
You can also use the JavaScript event digistore24_affiliate:
<script>
window.addEventListener('digistore24_affiliate', function (event) {
console.log( 'Affiliate: ' + event.detail.affiliate );
console.log( 'Campaignkey: ' + event.detail.campaignkey );
console.log( 'Vendorkey: ' + event.detail.trackingkey );
}, false);
</script>
Access rights
Read access required.
Arguments
affiliate_name – The name of the HTML form input field to be updated with the affiliate name. Input fields with this name or ID receive the affiliate name.
campaingkey_name – Analog for the campaign key (of the affiliate)
trackingkey_name – Analog for the tracking key (of the vendor)
callback (optional) – The name of a JavaScript function that is called up with the transferred data as soon as the affiliate has been determined. Definition: function( affiliate, campaignkey, tracking_param )
Return data
script_code: The complete JavaScript tag to be embedded. script_url: The script URL.