This article is intended for SMB & Enterprise clients who work directly with Quicklizard
# Variables
The SDK integration requires you to define the following variables inside the SDK's embed code:
Variable | Purpose | Page Availability |
---|---|---|
clientKey |
| Product / Payment Confirmation |
productId |
| Product / Payment Confirmation |
shelfPrice |
| Product |
permalink |
| Product |
salePrice |
| Payment Confirmation |
Your SDK clientKey is usually provided by Quicklizard upon initial client setup - Please verify you are using the correct clientKey before publishing the SDK to your live site
# Step 1 - SDK Embed Code
Please copy the following two code snippets, and place them in your sites product and payment confirmation pages respectively.
# Product Page Embed Code
<script>
window.QLAsync = function(QL){
var clientKey = 'CLIENT_KEY',
productId = 'PRODUCT_ID',
shelfPrice = 0.0,
permalink = self.location.href;
QL.init(clientKey).setSDKPrefix('SDK_PREFIX'); // replace SDK_PREFIX with the correct value
QL.sendProductEvent(productId, {
price: parseFloat(shelfPrice, 10),
permalink: permalink
});
}
</script>
<script src="//d3jdlwnuo8nsnr.cloudfront.net/sdk/v3.0/ql.js"></script>
# Payment Confirmation Page Embed Code
<script>
window.QLAsync = function(QL){
var clientKey = 'CLIENT_KEY',
productId = 'PRODUCT_ID',
salePrice = 0.0;
QL.init(clientKey).setSDKPrefix('SDK_PREFIX'); // replace SDK_PREFIX with the correct value
QL.sendConfirmationEvent(productId, {
price: parseFloat(salePrice, 10)
});
}
</script>
<script src="//d3jdlwnuo8nsnr.cloudfront.net/sdk/v3.0/ql.js"></script>
# Step 2 - Set variable values
For each code snippet, you must now replace variable placeholders with actual values from your database.
The following example shows you how to set the required variables inside your server-side templates for each page the SDK is installed on.
Note that for the sake of this example, it is assumed your server-side template language uses <%= %> tags to print
content.
Please adjust the example to work with your server-side template language.
Please adjust the example to work with your server-side template language.
# Product Page Embed Code
<script>
window.QLAsync = function(QL){
var clientKey = '<%= $clientKey %>', // <---- define $clientKey in your server-side template code
productId = '<%= $productId %>', // <---- define $productId in your server-side template code
shelfPrice = '<%= $shelfPrice %>', // <---- define $shelfPrice in your server-side template code
permalink = self.location.href;
QL.init(clientKey).setSDKPrefix('SDK_PREFIX'); // replace SDK_PREFIX with the correct value
QL.sendProductEvent(productId, {
price: parseFloat(shelfPrice, 10),
permalink: permalink
});
}
</script>
<script src="//d3jdlwnuo8nsnr.cloudfront.net/sdk/v3.0/ql.js"></script>
# Payment Confirmation Page Embed Code
<script>
window.QLAsync = function(QL){
var clientKey = '<%= $clientKey %>', // <---- define $clientKey in your server-side template code
productId = '<%= $productId %>', // <---- define $productId in your server-side template code
salePrice = '<%= $salePrice %>'; // <---- define $salePrice in your server-side template code
QL.init(clientKey).setSDKPrefix('SDK_PREFIX'); // replace SDK_PREFIX with the correct value
QL.sendConfirmationEvent(productId, {
price: parseFloat(salePrice, 10)
});
}
</script>
<script src="//d3jdlwnuo8nsnr.cloudfront.net/sdk/v3.0/ql.js"></script>