How to create a revenue goal for a/b test in Zoho PageSense | Help Guide

Add a revenue goal to your variation

PageSense allows you to measure the revenue generated on your website when your visitor performs a successful purchase or payment transaction on your A/B (and Split URL) experiment page. To track the revenue value for each variation of your experiment, you need to add a two-line Javascript code(in addition to the PageSense code snippet) in the payment success page of your website. In this code, you must define the value of the revenue you want to track conversions for. Typically, a revenue goal will be set up in the 'thank you or payment confirmation' page of your website and you may use this to track how different variations impact the total revenue of your business in comparison to the original version. Furthermore, once you add the required revenue code to your site, you’ll be able to see the revenue earned per visitor, revenue per paying visitor, and revenue per purchase for each of your variations in your Reports page.
For example, say you want to track the revenue made from every purchase on your ecommerce website and further analyze which variation of your A/B test performs better and generates high profit to your business. In this case, you can add the revenue tracking code snippet in the 'Thank You or Purchase Confirmation' page of your shopping site. 
Alternatively, you can also use revenue goals to see which of your advertisement or notification campaigns is working best for your website. For example, let's say you have added an extra discounted price offer for cart abandoning visitors in one version of your webpage, and a coupon code for free delivery in another one. By tracking the maximum purchase obtained in individual campaigns, you can decide whether to use the same campaign idea for the upcoming sale as well. 

To setup a revenue goal to your experiment:

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.




4. Replace the <<REVENUE AMOUNT>> tag in the code below with the currency value (or variable) that denotes the cumulative monetary value of your purchases you want to track. 
window.pagesense = window.pagesense || [];           
window.pagesense.push(['trackRevenue', 'c88QcBa', <<REVENUE AMOUNT>>]);
You can pass both static and dynamic value to track your revenue value in the code snippet. Lets understand this with examples. 
  1. To pass a constant currency value:
    You need to replace the <<REVENUE AMOUNT>> tag in the script with the purchase value multiplied by 100, i.e. (Purchase value*100). This method of passing a discrete value in your revenue code can be used to measure the total revenue or profit made by an individual item, a newly launched product, a discounted item, or a high-demand product on your ecommerce site. You can also use this to identify which particular type of subscription plan is bringing high revenue to your website. 
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: 
  1. 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. 
  2. 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).
  3. 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. 
  1. To pass a dynamic revenue value:
    You can also track the total revenue generated by passing a JS variable that stores the revenue for every purchase on your website. 
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:
  1. Note that in the above script the 'c88QcBa' is just a sample. It will be different for the experiment configured.
  2. The PageSenses' code snippet has to be installed on your website before the Revenue goal script. 
  3. 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>

            function Purchase( ){
             //add your revenue goal here  
            }
  <\script> 
   
 <after adding the snippet->
<script>
                  function Purchase( ){
                  window.pagesense = window.pagesense || [];

     window.pagesense.push(['trackRevenue', 'c88QcBa', totalprice]);

     }

<\script>

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.

Setup multiple revenue goals on a single page

By default, PageSense allows creating one revenue tracking goal for each test. However, to track multiple revenue goals on a single page, such as the thank you or confirmation page of your website, you can add multiple revenue tracking goals. 
For example, let's say you want to capture the revenue of all transactions that happen on your shopping site and want to track the revenue for certain special items that visitors purchase, as well.
In this case, first you need to add the revenue code that tracks the overall revenue (regardless of the product purchased) by passing the variable that stores the purchase amount of your website, into the <<REVENUE AMOUNT>> tag of the revenue code script shown below:
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 || [];

      window.pagesense.push(['trackRevenue', 'c88QcBa', totalprice]);

      window.pagesense = window.pagesense || [];
      window.pagesense.push(['trackRevenue', 'c88QcBb', 5400]);
      }
<\script>
Note:
  • 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. 

Alternatively, you can also refer to this document that explains how you can insert PageSense Revenue Goal via Google Tag Manager.

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. 

Setup revenue tracking goal in Shopify website:

When you add the PageSense JS code to your Shopify Website, it will be added to all the pages of your website, except for the "Checkout" and "Thank you" pages of your site. However, if you wish to set up a revenue tracking goal on the "Thank you" page, follow the steps below:

1. Log in to your Shopify account
https://accounts.shopify.com/store-login and navigate to Settings -> Customer events -> Add Custom Pixel.



2. 
Add the below mentioned code inside your Custom Pixel.

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()

});


3.  Replace <SNIPPET_SRC> with the PageSense tracking code snippet's from the related Project you wish to track your Shopify site.

4. Once you have added the PageSense code snippet, paste the revenue tracking code right after the PageSense code in the same field as shown below. You can pass both static  and dynamic value to track your revenue value in the code snippet.
  1. To track revenue of a particular product, copy-paste the below code in the text box and replace 'revenue' with the purchase value you want to track (i.e. passed as purchase value*100).
    <script>
    window.pagesense = window.pagesense || [];
    window.pagesense.push(['trackRevenue','replace with your unique code', revenue])
    <script>

    For example, say you want to track the amount of revenue made by visitors who bought a particular item priced at $99 on your ecommerce site. In this case, you need to replace revenue by 9900 (99*100) in the snippet code as shown below.

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)

});


  1. To track the total revenue made on your website, you need to paste the following code in the text box:

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)

});




Note:
  • 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


4. Once done, click Save.

We hope this documentation is self-explanatory and helps you understand the process with ease. Please feel to reach out to us anytime by dropping a mail to support@zohopagesense.com, in-case you need more explanation or have any queries.

    Access your files securely from anywhere

      Zoho CRM Training Programs

      Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

      Zoho CRM Training
        Redefine the way you work
        with Zoho Workplace

          Zoho DataPrep Personalized Demo

          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.

          Zoho CRM Training

            Create, share, and deliver

            beautiful slides from anywhere.

            Get Started Now


              Zoho Sign now offers specialized one-on-one training for both administrators and developers.

              BOOK A SESSION





                          Quick Links Workflow Automation Data Collection
                          Web Forms Enterprise Begin Data Collection
                          Interactive Forms Workplace Data Collection App
                          CRM Forms Customer Service Accessible Forms
                          Digital Forms Marketing Forms for Small Business
                          HTML Forms Education Forms for Enterprise
                          Contact Forms E-commerce Forms for any business
                          Lead Generation Forms Healthcare Forms for Startups
                          Wordpress Forms Customer onboarding Order Forms for Small Business
                          No Code Forms Construction RSVP tool for holidays
                          Free Forms Travel
                          Prefill Forms Non-Profit

                          Intake Forms Legal
                          Mobile App
                          Form Designer HR
                          Mobile Forms
                          Card Forms Food Offline Forms
                          Assign Forms Photography
                          Mobile Forms Features
                          Translate Forms Real Estate Kiosk in Mobile Forms
                          Electronic Forms

                          Notification Emails for Forms Alternatives Security & Compliance
                          Holiday Forms Google Forms alternative  GDPR
                          Form to PDF Jotform alternative HIPAA Forms
                          Email Forms
                          Encrypted Forms
                          Embeddable Forms
                          Secure Forms
                          Drag and Drop form builder
                          WCAG


                                            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.




                                                Manage your brands on social media

                                                  Zoho Desk Resources

                                                  • Desk Community Learning Series


                                                  • Digest


                                                  • Functions


                                                  • Meetups


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner


                                                  • Word of the Day


                                                    Zoho Marketing Automation

                                                      Zoho Sheet Resources

                                                       

                                                          Zoho Forms Resources


                                                            Secure your business
                                                            communication with Zoho Mail


                                                            Mail on the move with
                                                            Zoho Mail mobile application

                                                              Stay on top of your schedule
                                                              at all times


                                                              Carry your calendar with you
                                                              Anytime, anywhere




                                                                    Zoho Sign Resources

                                                                      Sign, Paperless!

                                                                      Sign and send business documents on the go!

                                                                      Get Started Now




                                                                              Zoho TeamInbox Resources



                                                                                      Zoho DataPrep Resources



                                                                                        Zoho DataPrep Demo

                                                                                        Get a personalized demo or POC

                                                                                        REGISTER NOW


                                                                                          Design. Discuss. Deliver.

                                                                                          Create visually engaging stories with Zoho Show.

                                                                                          Get Started Now









                                                                                                              • Related Articles

                                                                                                              • Add an engagement goal to your variation

                                                                                                                Creating engagement goals in A/B testing is another way to determine which version of your experiment performs better, and to get more engagement than your original site. This goal tracks any type of visitor behavior or interaction on your web page, ...
                                                                                                              • Add a custom event goal to your variation

                                                                                                                A custom event goal is a slightly more advanced method of tracking every single behavior of a visitor on the page you are testing. This includes watching a video, submitting a form, completing a payment, or any other event that could not be tracked ...
                                                                                                              • Create and launch an A/B test in PageSense

                                                                                                                A/B testing helps you analyze and observe how one version of a web page performs alongside another in front of your audience. On Zoho PageSense, you can quickly create, edit, and launch different versions of your web page, and test which one version ...
                                                                                                              • Create and launch a Split URL test in PageSense

                                                                                                                Use Split URL testing when you want to test multiple versions of your web page hosted on different URLs. This type of test is considered best when you notice several deficiencies in your existing page that might affect conversion. In such cases, it's ...
                                                                                                              • Add a page view goal to your variation

                                                                                                                A page view goal in A/B testing lets you track conversions when a visitor lands on a specific page or set of pages. You can use advanced URL match types to track the goals on multiple pages. For example, if your goal is to check how many visitors ...
                                                                                                                Wherever you are is as good as
                                                                                                                your workplace

                                                                                                                  Resources

                                                                                                                  Videos

                                                                                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                  eBooks

                                                                                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                  Webinars

                                                                                                                  Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                  CRM Tips

                                                                                                                  Make the most of Zoho CRM with these useful tips.



                                                                                                                    Zoho Show Resources