How to report custom events with UET

How to report custom events with UET

Learn how to create custom events that allow you to track more than one type of conversion for a single webpage.

Bing Ads allows you to track custom events on your website, such as when people subscribe to a newsletter or download a white paper, as conversions. To learn more, see Why track custom events.

What are the advantages of using JavaScript?

  • The tag updates automatically when we receive any changes to the UET tag tracking code.
  • JavaScript allows Bings Ads to collect richer activity data to ensure accurate conversion tracking as well as improve remarketing in paid search.
  • Learn more about JavaScript.

Before you can report custom events, you need to:

  • Make sure you're using the JavaScript UET tag and add the UET tag tracking code to every page of your website. This will ensure you have access to the full functionalities of conversion tracking and remarketing. 
  • Update your UET tag by following the instructions below, and then add the updated UET tag to your website. Make sure to update the parameters per the tips.

JavaScript UET Tag

If you have a JavaScript UET Tag, you will need to add the following custom event JavaScript to the UET tag tracking code:

<script>
window.uetq = window.uetq || [];
window.uetq.push
({ 'ec':'Event category', 'ea':'Event action', 'el':'Event label', 'ev':'Event value' });
</script>

Note: Event value is a numerical value associated with that event. For example, the length of the video played, etc.

Non-JavaScript UET Tag

Note

A JavaScript UET tag is required to ensure you have access to the full functionalities of conversion tracking and remarketing. If you are using a non-JavaScript tag, please switch over to a JavaScript tag.

Tips

And then you want to customize this code using the following tips:

  • uetq is a JavaScript object instantiated by the UET tracking code when the page is loaded.
  • Event category, Event action, Event label and Event value included in the script above are parameters that you define. At least one of the 4 parameters must be included with a custom event.
  • The code inside the </script> tag should be instantiated when the user action (for example a button click) is complete. It could be wired up directly to an onclick event or wrapped inside a JavaScript function that is wired to the onclick event.
  • Some guidance on how to think about these parameters below, but it is up to you to use any value that makes sense.
    Event category: The category of event you want to track. For example, 'video.'
    Event action: The type of user interaction you want to track. For example 'play' or 'pause' etc.
    Event label: The name of the element that caused the action. For example 'trailer' or 'behindthescenes' etc.
    Event value: A numerical value associated with that event. For example, the length of the video played, etc.
  • You can use any string value for Event category, Event action, Event label. Event value is a decimal that can have any value between 0 and 999999999999 with 3 decimal fields.
  • Note that you can send the Event value above without quotes given it is a numerical value. For example - <button onclick="window.uetq = window.uetq || []; window.uetq.push({ 'ec':'Video', 'ea':'Play', 'el':'Product Demo', 'ev':5 });">Play>/button>. Event value 5 is passed without quotes.
Notes

See more videos...