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.

Before you can report custom events, you need to:

  • Check which version of the UET tag you have on your website: JavaScript or Non-JavaScript

    To learn more see, JavaScript vs. Non-JavaScript UET tag tracking code.

  • 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

If you have a non-JavaScript UET Tag, you will need to update the tracking code with the event parameters values you defined in the conversion goal:

<noscript>
<img src="//bat.bing.com/action/0?ti=TAG_ID_HERE&Ver=2&ec=Event category&ea=Event action&el=Event label&ev=Event value" height="0" width="0" style="display:none; visibility: hidden;" />
</noscript>

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...