1. Go to the GOALS tab in your A/B or Split URL test and click + New Goal.
2. Choose Revenue from the left pane, then enter a descriptive name for the goal in the text box.
3. Click Copy, then paste the code shown on the screen into the purchase confirmation page of your web page's HTML where the revenue has to be calculated.
window.pagesense = window.pagesense || [];
window.pagesense.push(['trackRevenue', 'c88QcBa', <<REVENUE AMOUNT>>]);
For example, let's say you run an ecommerce site, and you have products with different value. Now you want to track the amount of revenue made by visitors who bought a particular item priced at $54 on your shopping site. In this case, you need to replace <<REVENUE AMOUNT>> with 5400 (54*100) in the snippet code as shown below.
Script before adding the purchase value:
<script>
window.pagesense = window.pagesense || [];window.pagesense.push(['trackRevenue', 'c88QcBa', <<REVENUE AMOUNT>>]);
<\script>
Script after adding the purchase value:
<script>window.pagesense = window.pagesense || [];
window.pagesense.push(['trackRevenue', 'c88QcBa', 5400]);
<\script>
Note:
- By default, PageSense accepts the revenue value in cents (smallest monetary unit), which is equal to 1/100th of a dollar(in countries like US, Canada, and Australia), 1/100th of a euro in European countries, and 1/100th of a rupee in India. You will need to multiply the purchase amount in your currency by 100, i.e. (purchase amount *100). This value has to be given from your end to parse revenue. Make sure not to alter any other part of the revenue tracking snippet.
- It is also crucial that the revenue value is passed to PageSense as an integer. However, if you've purchase value as a floating point number, say $10.99, you need to pass it as 1099 (10.99*100).
- If you enter a revenue value as a comma-separated value without decimals, PageSense will consider it as an invalid input and will not track any data on your page. Make sure to add the revenue value without the comma (,), such as 1500.
For example, let's consider your website's total purchase amount is stored in a JS variable called 'totalprice'. The variable 'totalprice' then needs to be passed as an argument in place of <<REVENUE AMOUNT>> to your revenue snippet, as shown below.
Script before passing the JS variable:
<script>window.pagesense = window.pagesense || [];
window.pagesense.push(['trackRevenue', 'c88QcBa', <<REVENUE AMOUNT>>]);
<script>
Script after passing the JS variable:
<script>window.pagesense = window.pagesense || [];
window.pagesense.push(['trackRevenue', 'c88QcBa', totalprice]);
<\script>
Key points to remember:
- Note that in the above script the 'c88QcBa' is just a sample. It will be different for the experiment configured.
- The PageSenses' code snippet has to be installed on your website before the Revenue goal script.
- The revenue variable is unique to each website and ecommerce website. Ensure you pass the variable that is defined for your website.
5. Click Save, then Next to proceed with the remaining settings in your A/B or split URL test.
Here's how the sample web page code might look like before and after adding the revenue script:
<before adding the revenue script->
<script>
window.pagesense.push(['trackRevenue', 'c88QcBa', totalprice]);
}
6. Once the data is collected, you will be able to track the revenue on the REPORTS tab of your A/B or Split URL experiment.
window.pagesense = window.pagesense || [];
window.pagesense.push(['trackRevenue', 'c88QcBa', <<REVENUE AMOUNT>>]);
Second, you need to add the revenue code for just the products you wish to track independently with PageSense by passing the purchase value (i.e. purchase value*100) to the <<REVENUE AMOUNT>> tag of the revenue code script. For example, if the price of the special item you want to track revenue for is $54, then you need to enter the amount as 5400 in your revenue code.
Based on our example, the confirmation page logic on your site may look something like below:
<script>
function Purchase( ){
window.pagesense = window.pagesense || [];
Ensure that the revenue value passed is converted to cents (i.e. multiplied by 100), before it's passed to the revenue tag in the script.
We recommend that revenue tracking script be placed on the confirmation or thank you page of your website after a successful transaction has occurred.
A few reasons your revenue goal might not be working
The Zoho PageSense Project code is not added to the webpage where you're tracking your revenue goal. Learn how to add PageSense code to your site.
The <<REVENUE AMOUNT>> you entered is not given in cents. If amount is $54, it should be added as 54 x 100 = 5400.
You may have also passed the currency symbol along with the revenue value in the Revenue goal code snippet.
If the revenue goal you're tracking is on a different domain. In this case, enable the Cross Domain tracking option under the Project Settings to track visitors and conversions.
function injectPagesenseSnippet(onLoadCallBackFunction) {
const pageSenseScript = document.createElement("script");
pageSenseScript.type = "text/javascript";
// Replace the snippet url below
pageSenseScript.src = "<SNIPPET_SRC>";
if (onLoadCallBackFunction && typeof onLoadCallBackFunction === 'function') {
pageSenseScript.onload = () => {
onLoadCallBackFunction()
}
}
document.head.appendChild(pageSenseScript);
}
analytics.subscribe("checkout_started", (event) => {
injectPagesenseSnippet()
});
function injectPagesenseSnippet(onLoadCallBackFunction) {
const pageSenseScript = document.createElement("script");
pageSenseScript.type = "text/javascript";
// Replace the snippet url below
pageSenseScript.src = "<SNIPPET_SRC>";
if (onLoadCallBackFunction && typeof onLoadCallBackFunction === 'function') {
pageSenseScript.onload = () => {
onLoadCallBackFunction()
}
}
document.head.appendChild(pageSenseScript);
}
// Inject snippet for data tracking on checkout page
analytics.subscribe("checkout_started", (event) => {
injectPagesenseSnippet()
});
// Inject snippet for data tracking on `checkout complete` event
analytics.subscribe('checkout_completed', (event) => {
const checkout = event.data.checkout;
const checkoutTotalPrice = checkout.totalPrice?.amount;
const onLoadCallBackFunction = () => {
window.pagesense = window.pagesense || [];
// Replace the Revenue tracking goal snippet below.
window.pagesense.push(['trackRevenue', 'c88QcBa', 9900]);
}
injectPagesenseSnippet(onLoadCallBackFunction)
});
function injectPagesenseSnippet(onLoadCallBackFunction) {
const pageSenseScript = document.createElement("script");
pageSenseScript.type = "text/javascript";
// Replace the snippet url below
pageSenseScript.src = "<SNIPPET_SRC>";
if (onLoadCallBackFunction && typeof onLoadCallBackFunction === 'function') {
pageSenseScript.onload = () => {
onLoadCallBackFunction()
}
}
document.head.appendChild(pageSenseScript);
}
// Inject snippet for data tracking on checkout page
analytics.subscribe("checkout_started", (event) => {
injectPagesenseSnippet()
});
// Inject snippet for data tracking on `checkout complete` event
analytics.subscribe('checkout_completed', (event) => {
const checkout = event.data.checkout;
const checkoutTotalPrice = checkout.totalPrice?.amount;
const onLoadCallBackFunction = () => {
window.pagesense = window.pagesense || [];
// Replace the Revenue tracking goal snippet below.
window.pagesense.push(['trackRevenue', 'ZMXP4LL', (checkoutTotalPrice * 100)]);
}
injectPagesenseSnippet(onLoadCallBackFunction)
});
In the above script, the {{order.total_price}} is Shopify's variable that will hold the purchase amount.
Make sure the PageSense snippet is added just above the revenue code on your page.
You can get your unique revenue tracking goal under the GOALS tab of your experiment while creating your revenue goal
Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.
If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.
You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.