How to report variable revenue with UET

How to report variable revenue with UET

Conversions can range from downloading white papers to submitting contact forms and making purchases. Very often these conversions have a revenue value associated with them that you can use to track the Return on ad spend (ROAS) on Microsoft Advertising. UET allows you to report revenue for this purpose.

Conversion goals allow you to track what your customers do on your website, which can range from making purchases to signing up for reward programs. Each of these actions probably brings a different value to your business. That's why we let you associate a different, specific revenue value to each conversion goal to track your return on investment (ROI). This is called reporting variable revenue. Both the destination URL and event conversion goals can report variable revenue.


Before you start setting up variable revenue, make sure you have:

How to set up variable revenue reporting

Step 1: Set up variable revenue conversion tracking in your Microsoft Advertising account expando image
You need to make sure that the destination URL or event conversion goal is set up for variable revenue.
  1. In the left navigation pane, click Conversion Tracking and then Conversion goals (or from the global menu at the top of the page, click Tools and then Conversion goals).
  2. In the Type column, find a destination URL or event conversion goal. If you don't have one, click Create conversion goal to create one.
  3. Select the destination or event conversion goal, and then click Edit and Edit goal.
  4. Click Next.
  5. Under Revenue value, select The value of this conversion action may vary (for instance, by purchase price). Then enter the default amount and select the default currency to be used when no value is received for a conversion.
  6. Click Save.

To see the complete list of currencies available for conversion goals, see Conversion Goal Revenue Currencies.

Step 2: Add or modify the UET tag tracking code on your website expando image

If you are using a tag manager or if your site is hosted on a website platform, take a look at the "Add the UET tag tracking code using a tag manager" or "Add the UET tag tracking code using your website platform" section of this article for instructions on setting up UET tags.

Next, you will want to edit the UET tracking code to support variable revenue. If you have already added the UET tag tracking code to your website, you can modify the tag in your website's code. If you haven't added the tag to your website yet, see How do I add a UET tag to my website?, but make sure you add the tag to the body section of the conversion goal confirmation page.

Let's look at how to pass variable revenue for a destination URL type goal in PHP pages. In the below example, it's reading a dynamic value for the variable revenue from a JavaScript function. You can just as easily send a static value or read from a JavaScript variable or HTML element.

To add the code to PHP pages using your webpage editor, see the sample UET tag tracking code below:

   (function(w,d,t,r,u){var f,n,i;w[u]=w[u]||[] ,f=function(){var o={ti:"TAG_ID_HERE"}; o.q=w[u],w[u]=new UET(o),w[u].push("pageLoad")} ,n=d.createElement(t),n.src=r,n.async=1,n.onload=n .onreadystatechange=function() {var s=this.readyState;s &&s!=="loaded"&& s!=="complete"||(f(),n.onload=n. onreadystatechange=null)},i= d.getElementsByTagName(t)[0],i. parentNode.insertBefore(n,i)})(window,document,"script"," //","uetq");

<script> function GetRevenueValue() { return 6; } </script>
<script> window.uetq = window.uetq || []; window.uetq.push('event', '', {'revenue_value': GetRevenueValue(), 'currency': 'Replace_with_Currency_Code'}); </script>
  1. Open your conversion confirmation page file. If multiple pages are generated from the same file, find the section in the file that generates your conversion page.
  2. Add or confirm that your site has a JavaScript function that defines variable revenue. In the above code, it is:
       function GetRevenueValue()
             return 6;

    You’ll need to replace this section with your own JavaScript function.

  3. Append the uetq.push code to the end of the UET tag tracking code to associate the revenue value with a conversion goal. Update the amount value for 'revenue_value' parameter with value defined in step 2. In the above code, it is:
       window.uetq = window.uetq || [];
       window.uetq.push('event', '', {'revenue_value': GetRevenueValue(), 'currency': 'Replace_with_Currency_Code'});  

    • The command 'event' is always required, even if you're not reporting any Event action. When you're reporting variable revenue for a destination URL goal, you need to leave Event action empty (as in, 'event', '') and can only have revenue_value and currency parameters in the event.
    • To see the complete list of currency codes, see Conversion Goal Revenue Currencies. You can remove the 'currency' parameter if no currency is set in the conversion goal.

  4. Make sure you add the modified UET tag tracking code to the body of the conversion confirmation page, which is the page the customer sees after they complete the action you want to track (for example, the Purchase confirmation page).

    Tip: Search for the "</body>" tag and place the UET tag tracking code immediately above it.

  5. Save and upload the page to your web server.
Advanced: Code samples for event conversion goalsexpando image

Now that you know the code to append to the end of the UET tag tracking code for destination URL conversion goals, here are a few others you might want to try:

Event conversion goal

There is different code you need to append to report variable revenue for an event conversion goal. If you are using the same JavaScript function as in Step 2, it would look like this:

   window.uetq = window.uetq || [];
   window.uetq.push('event', 'Event action', {'event_category': 'Replace_with_Event_Category', 'event_label': 'Replace_with_Event_Label', 'event_value': 'Replace_with_Event_Value', 'revenue_value': GetRevenueValue(), 'currency': 'Replace_with_Currency_Code'});  

Note: To see the complete list of currency codes, see Conversion Goal Revenue Currencies.

  • To see an example of a variable revenue UET tag installed in the body of a webpage, visit this webpage (English only), right-click in the webpage, and then click View source or View page source depending on your browser.
  • As your webpage loads, it triggers the UET tag, resulting in a number of HTTP requests. The most important request is to "" (the one that looks like ""). This request tells Microsoft Advertising about the user visits to your webpage. You can use third-party tools such as Fiddler to monitor all the requests that your browser is making when your webpage loads.
  • For variable revenue, an additional HTTP request is triggered to report this value to Microsoft Advertising. It is similar to the but it has different parameters to report revenue (as opposed to just page visit).
  • You can validate the variable revenue tag using UET Tag Helper.

See more videos...