Tracking on Bing Via Pixels

Tracking on Bing Via Pixels

healthystuff
Tourist
6 0 1

Hi,

 

We are trying to set up Bing on our website and are running into a few teething issues.

Basically, the accounts aren't tracking on our bing Ads.

(function(w,d,t,r,u){var f,n,i;w[u]=w[u]||[],f=function(){var o={ti:"OURIDISHERE", enableAutoSpaTracking: true};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","https://bat.bing.com/bat.js","uetq");

 

analytics.subscribe("checkout_completed", (event) => {

  const purchaseData = event.data;
  const checkout = event.data.checkout || {};
  const lineItems = checkout.line_items || [];
  window.uetq = window.uetq || [];

  const totalPrice = parseFloat(checkout.total_price || 0);
    const currency = checkout.currency || 'GBP';
    const email = checkout.email || '';
    const phone = checkout.phone || '';

    const productIds = lineItems.map(p => String(p.product_id || p.id)).join(',');

    // Enhanced conversions (email/phone) — Microsoft hashes automatically
    if (email || phone) {
      window.uetq.push('set', {
        pid: {
          ...(email && { em: email }),
          ...(phone && { ph: phone })
        }
      });
    }
  
  
  fbq('track', 'orderConfirmation', {
    currency: event.data?.checkout?.currencyCode,
    value: event.data?.checkout?.totalPrice?.amount,
  });

    window.uetq.push('event', 'PRODUCT_PURCHASE', {"ecomm_prodid":productIds,"ecomm_pagetype":"PURCHASE","revenue_value":totalPrice,"currency":currency});

  // uetq.push('event', 'Purchase',{
  //   'event_category': 'Order Completed',               // Event Label
  //   'revenue_value': event.data?.checkout?.totalPrice?.amount,  // Event Value (number)
  //   'currency': event.data?.checkout?.totalPrice?.currencyCode, // Currency
  //   'order_id':  event.data?.checkout?.order?.id       // Order ID
  // });

  
  
});

 

As you can see below, the purchase event is firing, and logging as an event, however in our actual conversion goal? It is showing as no recent conversions.

 

Screenshot 2025-05-21 at 13.02.09.png

 

Please can someone advise where this may be going wrong please.

 

Just to set further context, I exported the data from Bing, and this is what is being received by the event.

 

Screenshot 2025-05-21 at 13.06.19.png

 

 

Thanks Kirsty

Reply 1 (1)

healthystuff
Tourist
6 0 1

Update:

I have updated the code where it states revenue_value to value. However again this is for me expecting to track and an individual purchase level and not the total order value (which i believe we are needing).