UET for single page web app

The website that I help support that I am trying to add UET to is a single-page app. In other words, navigating through the site consists of switching out the view of the page, not switching pages. Question #1: Does this affect how UET works and is it compatible with my site?

I only need UET for one conversion event. The conversion event that I want to track is a user purchasing a membership. Right now, I can't get conversions to trigger (or at least I don't see them in my Bing Ads account).

After filling out the appropriate form, a) the user is shown a confirmation page. At that point, the following code is executed to track the goal's value (represented by the variable "conversionValue", whatever it happens to be at the time):

    window.uetq = window.uetq || [];
    window.uetq.push({ 'gv': conversionValue });

(Note: In my goal setup, I have "Goal Value" switched off so that I can add a dynamic value here. Question #2: does "Goal Value" need to be turned on for the dynamic value to be assigned to the goal? If yes, what do I put in the setup for the static value knowing it will always be overwritten by the dynamic value?)

Immediately after this, b) the Bing Ads tag is inserted/executed into the body of the page. Question #3: will this work, or does the Bing Ads tag need to be inserted before pushing anything to window.uetq?

c) Once the user clicks "confirm" and navigates successfully to the "Thank you" page, the following code is executed to indicate that the event has happened:

    window.uetq = window.uetq || [];
    window.uetq.push({ 'el': 'Signed Up Online' });

In my goal setup, I have "Event Label" set as "Equal to" "Signed Up Online" Question #4: is simply pushing the 'el' value what triggers the event? If not, how custom events triggered?

Thanks, and let me know if I need to be more clear about anything.

Answer
Answer

Hi Jordan,

 Thank you for contacting Bing Ads Support.  You always want to place the tag as close to the header as possible.  Below I am going to attempt to answer your questions to assure I don’t miss anyone of them.

Question 1: Does this affect how UET works and is it compatible with my site? No

 1st goal is an event that is set at the base upon the click to purchase.

Bing Ads makes it easy and generates one Universal Event Tracking tag (noted above) to track destination, duration, and pages-per-visit goals across your entire website. If you add an event goal, use the template below to write the code you'll add to your website in addition to the Universal Event Tracking tag:

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

 </script>

The code for events consists of four values you can use to define a user's interaction. None of the parameters are mandatory, but you must define at least one value:

  • Event category (ec): The object you want to track (e.g., "button").

  • Event action (ea): The type of interaction the user takes with the object from your event category (e.g. "click").

  • Event label (el): Useful field for you to label details about the event (e.g. "purchase button").

  • Event value (ev): Use this field to associate non-negative numerical data with the goal to track counts (e.g. A video is paused four times).

Paste your modified code into the webpage where the custom event occurs. For example, to track the button click, paste your code after you call the button function in your webpage. Save your webpage.

Question #2: does "Goal Value" need to be turned on for the dynamic value to be assigned to the goal? If yes, what do I put in the setup for the static value knowing it will always be overwritten by the dynamic value?)  No

How to set dynamic goal values

When creating goals in Bing Ads, you're prompted to assign an optional goal value. This numerical value will be constant. However, you also have the option to assign dynamic, or variable, goal values for destination and event goals only. This is a monetary value that represents the revenue associated with the goal, and is used to calculate the "revenue" of conversions in performance reports.

For destination goals

You can script dynamic goal values for destination goals in the following ways. In the snippets below, the function computeDiscount and the variable amount are examples used to show possible business logic. These functions would be replaced, defined and owned by the developer/advertiser.

Assign a variable to 'gv':

<script>
 function computeDiscount(discount, price) {

 return price - (discount / 100) * price; }

 var amount = computeDiscount (20,100); // Compute the goal value

</script>
 <script>
 window.uetq = window.uetq || [];

 window.uetq.push({ 'gv': amount }); // Pass the computed goal value

</script>

Directly call a function and assign to 'gv':

<script>
 function computeDiscount(discount, price) {

 return price - (discount / 100) * price; }

 </script>
 <script>
 window.uetq = window.uetq || [];

 window.uetq.push({ 'gv': computeDiscount(40, 100) }); // Compute and pass the computed goal value

 </script>

NoScript version:

If you opted to implement Bing Ads Universal Event Tracking using NoScript, simply pass your goal value (gv) in the URL section of a NoScript version of the tag as shown in the format below:

<img src="//bat.bing.com/action/0?ti=xxxxx&Ver=2&gv=50" height="0" width="0" style="display:none; visibility:hidden;" />

For event goals

You can script dynamic goal values for event goals in the following ways:

Assign a variable to 'gv':

<script>
 function computeDiscount(discount, price) {

 return price - (discount / 100) * price; }

 var amount = computeDiscount(20, 100); // Compute the goal value

  </script>
 <script>
 window.uetq =window.uetq || [];   // Pass the computed goal value

 window.uetq.push({ 'ec':'Event category', 'ea':'Event action', 'el':'Event label', 'ev':'Event value', 'gv':amount });

 </script>

NoScript version:

If you opted to implement Bing Ads Universal Event Tracking using NoScript, simply pass your goal value (gv) in the URL section of a NoScript version of the tag as shown in the format below:

<img src="//bat.bing.com/action/0?ti=xxxxx&Ver=2&gv=50" height="0" width="0" style="display:none; visibility:hidden;" />

Question #3: will this work, or does the Bing Ads tag need to be inserted before pushing anything to window.uetq? Yes the code should be placed on the site

Question #4 I would follow the instructions under Question #1  

If you would like to assure the events as well as the purchase page action please contact our Support Team via chat or call 1-800-518-5689

Regards

Priscilla

Bing Ads Support Engineer

http://help.bingads.microsoft.com/#apex/3/en-us/53048

 

 

Priscilla

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

 
 

Question Info


Last updated December 9, 2019 Views 719 Applies to: