Microsoft Advertising: campaigns, spend and Conversions API (UET)
Forward your AxiTrace conversions to Microsoft Advertising server-side, straight to your UET tag. Conversions arrive even when the browser UET tag is blocked by an ad blocker, a privacy setting or a consent banner, so Microsoft reporting and bidding keep working on complete data. Separately, AxiTrace can sign in with Microsoft and import your campaigns and spend.
- Campaigns and spend only (analytics, nothing sent to Microsoft): in AxiTrace go to Connections → Ad accounts, find the Microsoft Advertising card and click Connect Microsoft Advertising. Follow section 11 only. You do not need a UET tag, a Conversions API token or conversion goals, and AxiTrace sends no conversions to Microsoft.
- Send conversions to Microsoft: go to Connections → Conversion destinations, find the Microsoft Ads Conversions API card and click Set up. Follow sections 2 to 10.
- Both: set up each card. Neither needs the other, and disconnecting one leaves the other running.
HTTP 200 and records no conversion, with no error anywhere. The
event names are fixed and listed in section 5.
On this page
- Campaigns only, conversions only, or both
- 1. What this integration does
- 2. Get your UET tag ID
- Do you need the UET tag on your site?
- 3. Get your Conversions API token
- 4. Get your customer ID (CID)
- Connect in AxiTrace
- 5. Create the conversion goals
- 6. Turn on Enhanced conversions per goal
- 7. Microsoft Click ID auto-tagging
- 8. Conversion windows
- 9. What AxiTrace sends
- 10. Deduplication
- 11. Import spend and campaigns (Sign in with Microsoft or Google)
- 12. Troubleshooting
- 13. Reporting latency
- 14. Shopify
- 15. Consent Mode and the browser tag
Official Microsoft references used in this guide:
- UET Conversions API integration guide
- Create a UET tag
- Get started (customer ID and account ID)
- Event goal reference
- Enhanced conversions
- Microsoft Click ID auto-tagging
What this integration does
AxiTrace sends each enabled conversion from its own servers to the UET Conversions API endpoint
POST https://capi.uet.microsoft.com/v1/{tagId}/events, authenticated with a per-workspace
Conversions API token
(UET Conversions API integration guide).
One conversion is one request.
The integration has two halves, and each is its own connection in AxiTrace. The first half forwards conversions to Microsoft through the UET Conversions API, described in sections 2 to 10 (the Microsoft Ads Conversions API card under Connections → Conversion destinations). The second half signs in with Microsoft and imports spend and campaigns from your Microsoft Advertising account (section 11; the Microsoft Advertising card under Connections → Ad accounts), so spend and campaign results sit next to the visits and orders AxiTrace recorded. You can use either half without the other.
AxiTrace sends custom events only. Every event carries
eventType: "custom" and one of the ten fixed event names in section 5. AxiTrace does
not send pageLoad events, so page views never reach Microsoft through this
integration and a UET page-load goal is never fed by AxiTrace.
A browser bridge is part of the integration as well: the AxiTrace web SDK can push the same conversions into an
already installed UET tag with the same event id, and it can fire Microsoft ID Sync so that the anonymous
visitor id AxiTrace sends server-side is known to Microsoft. On Shopify the same two jobs are done by a Custom
Pixel snippet (section 14). On websites running the AxiTrace web SDK the bridge needs no setup: the SDK
detects an existing UET tag and pushes into it. Whether you need that tag at all is covered in
Do you need the UET tag on your site?
Microsoft documents ID Sync as a client-side pixel to https://c.bing.com/c.gif carrying a
Red3 and a VID parameter, and states:
"Fire the pixel on as many pages as practical and at least once per session, preferably on the first page view."
"The VID used in ID Sync should match the anonymousId sent in CAPI events."
UET Conversions API integration guide
Microsoft's documentation shows no example URL for that pixel, so here is the request as AxiTrace sends it, observed live (the two values are the customer ID and the visitor id, nothing else):
GET https://c.bing.com/c.gif?Red3=BACID_123456789&VID=e0e36e33-ad39-4cd7-b5b5-31e2f51ce698
Microsoft answers with a 200 image/gif and sets its own cookie on bing.com. The server leg described below works on its own and needs no browser change.
Get your UET tag ID
If you do not have a UET tag yet, Microsoft describes creating one as:
"From the navigation menu on the left, hover over Conversions and select UET tag. Select Create and then enter a UET tag name. ... Select Save."
Create a UET tag
The UET tag ID is the numeric
ti value inside that tracking code, for example ti: '123456789'. That number,
digits only and without any prefix, is what AxiTrace needs.
Microsoft does not document where the tag ID is displayed in the current interface, so this guide describes only
the tracking code. Reading the ti value out of the tracking code always works.
Do you need the UET tag on your site?
Not for conversions. AxiTrace sends every enabled conversion from its servers with the Conversions API token, and a conversion goal counts those events whether or not the UET tracking code is on your pages. You create the UET tag in Microsoft Advertising because the Conversions API is addressed by its tag ID and its token; pasting its tracking code into your site is a separate, optional step.
Install the tracking code on your pages when you want the browser half as well:
- Remarketing and page-visit audiences. AxiTrace sends no
pageLoadevents (section 1), so lists built on page visits are only populated by your own tag. - A browser copy of each conversion. When the tag is present, the AxiTrace web SDK pushes the same conversion into it with the same event id, and Microsoft deduplicates the pair (section 10). Without the tag the SDK skips that push; the server event is still sent.
| Where your site runs | What to do with the UET tracking code |
|---|---|
| Website with the AxiTrace web SDK (custom site, WooCommerce, Shopware, Magento, BigCommerce) | Optional. If you want it, paste Microsoft's tracking code into the <head> of every
page, the way Microsoft describes it, together with Consent Mode (section 15). Do not add any
AxiTrace-specific code: the SDK finds the tag on its own. If the tag is injected later by a tag
manager, the SDK waits up to 30 seconds for it. Microsoft ID Sync is fired by the SDK in both
cases, with or without the tag. |
| Shopify | Do not paste the tracking code into your theme for AxiTrace. The Microsoft UET Bridge Custom Pixel (section 14) loads Microsoft's base code inside Shopify's Customer Events sandbox, sends Consent Mode and pushes the events. A UET tag you already have in the theme or from another app can stay. |
Microsoft describes adding the tracking code to a website as:
"In the table, find the UET tag that you want to use and, in the Action column, select View tag."
"Paste the UET tag tracking code on every page of your website, either in the head or body section."
Everything you need to know about setting up UET
Get your Conversions API token
Microsoft describes the click path to the token as:
"Find your existing tag or provision a new UET tag ID in the UET section of your Microsoft Advertising account. Select your existing UET tag by using the pencil icon. Select Save and next in the Edit UET tag section. In the Set up tagging section, select Use Conversions API. In the Conversions API section, select Copy Token, select Next, and then select Done."
UET Conversions API integration guide
There is one token per UET tag. The token belongs to the tag it was copied from, and a token
from a different tag fails with HTTP 401. Copy the whole string: a truncated token also fails with
HTTP 401 on the first conversion.
Get your customer ID (CID)
The customer ID is optional. It is used only by the browser ID Sync leg. Microsoft describes finding it as:
"sign in to the Microsoft Advertising web application and click on the Campaigns tab. The URL will contain a cid key/value pair in the query string that identifies your customer ID, and an aid key/value pair that identifies your account ID."
Get started
Observed on a live account, the address bar on the Campaigns overview looks like this (numbers replaced):
https://ui.ads.microsoft.com/campaign/vnext/overview?aid=1234567&cid=987654321. Copy the digits
after cid=; the aid= value is your account ID and is not needed.
Connect in AxiTrace
In AxiTrace open your workspace, go to Connections → Conversion destinations (the section Send your conversions to ad platforms), find the Microsoft Ads Conversions API card and click Set up (Settings once it is saved). This page only sends conversions; importing campaigns and spend is the separate ad account connection in section 11. Fill in section 1. UET tag and Conversions API token:
| Field | What to enter |
|---|---|
| UET tag ID | The numeric ti value from section 2. Digits only, no prefix. |
| Conversions API token | The token copied in section 3. It is stored with the connection and never displayed again. When you edit the connection later, leave the field empty to keep the stored token, or paste a new token to replace it. |
| Microsoft customer ID (CID) | Optional, digits only, from section 4. Needed only for ID Sync. Leave it empty and ID Sync simply does not fire. |
In section 2. Events forwarded to Microsoft tick the events you want sent. Keeping them all on is recommended, because Microsoft bids better on a complete funnel. Page views are shown disabled and are never sent in this version. Then save: saving validates and stores the settings and activates the connection.
Create the conversion goals
Microsoft only counts an event that a conversion goal is watching for. You create one goal per event name you want counted. Goals match on Action, and optionally on Category, Label and Value (Event goal reference). AxiTrace never sends a category or a label, so a goal that also requires one of them can never match an AxiTrace event. Match on the Action alone.
Purchase, purchase with a trailing space, or add-to-cart instead of
add_to_cart all produce zero conversions while every request still returns HTTP 200.
Copy the values out of the table below rather than typing them.
Create the goal with the operator Equals and the Action exactly as listed:
| Action (the event name AxiTrace sends) | Operator | AxiTrace events that produce it |
|---|---|---|
purchase |
Equals | transaction.charge, transaction, purchase |
add_to_cart |
Equals | product.addToCart, add_to_cart, product.addtocart, product.add_to_cart |
begin_checkout |
Equals | initiate_checkout, begin_checkout, initiate.checkout, initiatecheckout |
add_payment_info |
Equals | add_payment_info, add.payment.info, addpaymentinfo |
generate_lead |
Equals | lead, contact, form_submit, form.submit |
sign_up |
Equals | complete_registration, sign_up, signup |
start_trial |
Equals | start_trial, start.trial |
subscribe |
Equals | subscribe |
search |
Equals | search |
view_item |
Equals | product.view, product_view, view_item, view_content, view.content, viewcontent |
The right-hand column lists every AxiTrace event name and alias that is sent under that event name, so a store
that emits product.addToCart and a plugin that emits add_to_cart both land on the same
goal. Sign-ups are sent as sign_up from registration form submissions and follow the
lead tick in the connection form.
Microsoft's help articles document only the route to goal creation, "Conversions > Conversion goals > Create > Website > choose goal category and type" (Microsoft Advertising help). The individual field labels and the operator control of that form are not documented, so this guide gives you the values to enter rather than naming the boxes to enter them in.
Turn on Enhanced conversions per goal
AxiTrace sends the hashed email and the hashed phone number when it has them. Microsoft uses those only when Enhanced conversions is on for the goal:
"Turn on Enhanced conversions"
"Selecting Enhanced Conversion will only apply to the current conversion goal"
Enhanced conversions
There is no account-level switch. The setting applies to the goal you are editing and to nothing else, so repeat it for every goal you created in section 5. A goal you add later starts without it.
Microsoft documents that the setting is per goal but not where the control sits in the current interface, so this guide does not describe its position on the screen.
Microsoft Click ID auto-tagging
The Microsoft Click ID (msclkid) is the strongest match key for this integration: it ties a
conversion to the exact ad click that produced it. Microsoft appends it to your landing-page URLs through
auto-tagging, which is enabled by default. Microsoft documents the setting as:
"hover over Campaigns and select Settings > Account level options > Add Microsoft Click ID (MSCLKID) to URLs to allow conversion tracking"
Microsoft Click ID auto-tagging
If that option was ever turned off, turn it back on: without msclkid on the landing URL, AxiTrace
can only match a conversion through the hashed email or phone number, and an event that carries none of the
three is dropped before it is sent (see section 9). The AxiTrace SDK, the Shopify pixel and the plugins read
msclkid at landing, store it on the visitor profile and attach it to later events from that
visitor. Microsoft documents the value as a UUID and suggests keeping it for 90 days, which is what AxiTrace
does.
Conversion windows
The conversion window is a property of the goal, not of the integration: 30 days by default and 90 days at most (Event goal reference). A conversion that happens later than the window of its goal is not counted, no matter how it was delivered. If your buying cycle is long, raise the window on each goal when you create it. This window is separate from the 7-day limit on how old an event may be when it is sent, which is covered in section 9.
What AxiTrace sends
One request per conversion, with eventType: "custom", the event name from section 5, a unique
eventId, the event time in seconds, and a userData object. AxiTrace identifies itself
to Microsoft as the sending data provider and never asks Microsoft to keep a payload that failed validation.
Identifiers in userData
| Field | What AxiTrace puts in it |
|---|---|
msclkid |
The Microsoft Click ID exactly as it arrived on the landing URL. It is sent raw, not hashed, which is what Microsoft expects. |
em |
The SHA-256 hash of the email, never the email itself. |
ph |
The SHA-256 hash of the phone number, never the number itself. |
anonymousId |
The anonymous AxiTrace visitor id of the browser that converted. It is the same value the browser ID
Sync leg uses as VID, which is what Microsoft asks for. |
externalId |
The SHA-256 hash of your own user id, when the event carries one. Never a plain user id. |
clientIpAddress, clientUserAgent |
The IP address and user agent of the original visit. Microsoft names both as preferred fields. |
Hashing rules
Microsoft's rules, which AxiTrace applies before sending:
- Email: trim whitespace, remove all dots from the user portion, remove the
+aliasfrom the user portion, lowercase, then SHA-256 as lowercase hex. - Phone: E.164 with country code, then SHA-256 as lowercase hex.
Both rules come from the UET Conversions API integration guide. A value AxiTrace cannot normalise, such as a phone number with no recognisable country code, is left out rather than sent as a hash Microsoft cannot match.
Identity floor
msclkid, em, ph or
anonymousId. Microsoft lists anonymousId among the accepted
userData identifiers, and AxiTrace's Microsoft ID Sync pixel is what makes it matchable: it hands
Microsoft the same anonymous visitor id under your Microsoft customer ID, so an anonymous browsing event still
has something to match on. An event with none of the four cannot be matched to a click or a person, so AxiTrace
drops it before the request is made and records in the connection log which signals were present. That is a
data-collection gap on your site, not an integration error: capture the email earlier in the funnel and keep
click-ID auto-tagging on (section 7).
Event age, consent, value and limits
- 7-day event window. Microsoft requires the event time to be within the last 7 days. AxiTrace drops an older event before sending it and records the reason, so a replay of old data never marks the connection unhealthy.
- Consent. An event whose visitor granted marketing consent carries
adStorageConsent: "G". An event whose visitor refused is never sent to Microsoft at all: your workspace consent policy blocks it before the request is made, so Microsoft never receives a denied conversion from AxiTrace. When the event reports no consent state the field is omitted and Microsoft's documented default (processed as granted) applies; whether such an event is forwarded at all is decided by Forward events that do not report a consent state in your workspace. See the Cookie consent guide. - Value and products. Order value, currency and transaction id are sent on
purchase, and value and currency on the other events that have them. Product details are sent asitemswhere they exist, with Microsoft's caveat that the items array "is used only for specific advertising products and is not applicable to standard conversion tracking goals." (UET Conversions API integration guide) - Rate limits. Microsoft documents a maximum of 1000 events per batch. AxiTrace sends one event per request, so that ceiling is never reached. No other rate limit is documented by Microsoft, so AxiTrace applies none of its own beyond retrying transient failures.
Deduplication
If you keep the browser UET tag and also send the same conversion server-side, Microsoft needs to recognise the two as one. Its rule is:
"When UET JavaScript and CAPI send the same conversion event, pass the same stable deduplication value in eventId and keep eventName compatible across both systems."
UET Conversions API integration guide
AxiTrace follows it on both legs: the browser bridge pushes event_id with exactly the value the
server leg sends as eventId, and both legs use the same event name from section 5. For purchases
that value is derived from the order itself, so a retry, a replay or a second page load never produces a second
conversion.
Import spend and campaigns (Sign in with Microsoft or Google)
The Conversions API half of this integration sends conversions to Microsoft. The second half reads your Microsoft Advertising data the other way: AxiTrace signs in with your Microsoft Advertising login (a Microsoft account, or a Google account if that is how you sign in to Microsoft Advertising), imports your accounts, campaigns, ad groups, ads and daily performance (impressions, clicks, spend and the conversions Microsoft reports), and shows spend and campaign results next to the visits and orders AxiTrace recorded. It is a separate connection from the UET Conversions API and does not replace it, and it works on its own: a merchant who only wants campaign and spend analytics connects this and skips sections 2 to 10.
Connect with Microsoft
In AxiTrace open your workspace, go to Connections → Ad accounts (the section
Connect your ad accounts), find the Microsoft Advertising card and click
Connect Microsoft Advertising. Sign in with the Microsoft account you use at
ads.microsoft.com and approve the access AxiTrace asks for, then pick the Microsoft Advertising
account to import from the list AxiTrace shows. If Microsoft offers an account you are already signed in with
(for example your work account) and it is not the one you use for Microsoft Advertising, choose
Use another account. AxiTrace requests the scope
https://ads.microsoft.com/msads.manage offline_access, which it uses read-only:
it reads accounts, campaigns, ad groups, ads and daily performance (impressions, clicks, spend and conversions
as reported by Microsoft) and never edits campaigns, ad groups, ads or budgets.
Sign in with Google
If you sign in to ads.microsoft.com with a Google account (the Sign in with Google
button on the Microsoft Advertising sign-in page), click Sign in with Google on the Microsoft
Advertising card instead of Connect Microsoft Advertising, and sign in with that same Google
account. You do not need to create a separate Microsoft account or add another user to your Microsoft
Advertising account. AxiTrace asks Google only for your identity (the scopes openid email profile),
never for access to Gmail, Drive or any other Google data; Microsoft Advertising uses that identity to decide
which accounts you can reach, with the same permissions as when you sign in at ads.microsoft.com.
The rest of the flow is the same: pick the account to import, and the access stays read-only.
AxiTrace remembers how you signed in, so Reconnect takes you back to Google. To switch a
connection from Google to a Microsoft account (or back), disconnect it and connect again with the other button.
Admin consent
Some Microsoft Entra tenants block user consent for third-party applications. In that case the sign-in shows
Need admin approval and nobody in the workspace can finish the connection. A tenant admin opens
the admin-consent link below and approves AxiTrace for the whole organization. Replace {tenant}
with the organization's tenant ID or primary domain.
https://login.microsoftonline.com/{tenant}/adminconsent?client_id=6e6935be-9295-4921-b28e-58059dfe5c87
One account per workspace
A workspace holds one Microsoft Advertising account at a time. Picking another account replaces the first one.
Final URL Suffix
So that AxiTrace can tie a visit and an order to the campaign that produced it, Microsoft Advertising has to put the campaign, ad group and ad ids on the landing URL. In Microsoft Advertising set the Final URL suffix at account level (or per campaign) to:
ms_campaign_id={CampaignId}&ms_adgroup_id={AdGroupId}&ms_ad_id={AdId}
Microsoft replaces those dynamic text tags with the ids of the ad that was clicked, and AxiTrace's matcher reads
the ms_campaign_id, ms_adgroup_id and ms_ad_id parameters from the
landing URL. Keep MSCLKID auto-tagging on as well (section 7). The same suffix is described in
the tracking URL parameters guide.
A missing suffix, or a URL tracking template that strips query parameters, breaks the match. Fix the suffix and wait for new clicks: clicks that already happened are not re-matched.
Conversions stay on the UET Conversions API
The Microsoft sign-in imports reporting data only. It does not create or upload conversion goals and it does not
send conversions. If you want conversions in Microsoft Advertising, set up the separate
Microsoft Ads Conversions API connection described in sections 2 to 10: an HTTP 200 from that connection and a matching event goal are what count a
conversion in Microsoft Advertising.
Data latency and refresh
Microsoft reporting data can be up to about 3 hours behind. AxiTrace re-fetches the last 7 days on every sync, so a recent day's spend and conversions can still change and settle within a week. Judge a new connection after the first full sync rather than minute by minute.
Troubleshooting
Every delivery attempt, with the HTTP status Microsoft returned, is visible in the connection log in your workspace's Event feed. Start there.
| Symptom | Cause and fix |
|---|---|
| Connection turns red, log shows HTTP 401 | The token is missing, incorrect, or not authorized for that UET tag. Microsoft answers
{"error":{"code":"Unauthorized","message":"You are not authorized to access this
resource."}} and evaluates this before it even looks at the payload, so it is always a
credential problem and never a data problem. Typical causes: the token was copied from a different
UET tag than the tag ID you entered, or part of the string was lost while copying. Copy the token
again (section 3), paste it into the connection and save. Saving clears the error and reactivates
the connection. |
| Log shows HTTP 400 | Payload validation failed. Microsoft returns one entry per problem, naming the property it rejected, the value it saw and the reason. AxiTrace records every one of those entries in the connection log and does not retry a 400, because the same payload would fail again. The connection keeps working for other events. Send the logged details to support if the cause is not obvious from the property name. |
| HTTP 200 on every event but the goal stays at zero | Almost always the goal's Action string does not match the event name. Microsoft accepts any custom event, counts it only if a goal is watching for that exact Action, and reports no error when none is. Open the goal, compare its Action with the value in section 5 character for character, and check the operator is Equals and that no Category, Label or Value condition is set. A goal created after the conversions were sent does not count them retroactively. |
| Log shows the event was dropped before sending | Either it carried none of msclkid, em, ph and anonymousId (see the identity
floor in section 9), or it was older than 7 days. The log line names which case it was. |
| Your own test conversion never appears on the goal | A conversion is counted when Microsoft can attribute it to an interaction with your ads inside the
goal's window (section 8). A test you trigger yourself normally follows no ad click, so a successful
HTTP 200 with nothing on the goal is the expected result. Treat the 200 in the
connection log as the proof of delivery, and judge the goal on real ad traffic. |
| Some conversions are counted, some are not | Match quality. Conversions from visitors who arrived through a Microsoft ad carry
msclkid and match best. For the rest Microsoft depends on the hashed email or phone,
which requires Enhanced conversions to be on for that goal (section 6). |
| The Microsoft Advertising card shows Reconnect required | The refresh token expired or was revoked: a password change, a removed user or a revoked application invalidates it. Click Reconnect on the Microsoft Advertising card under Connections → Ad accounts (section 11). The spend and campaign import resumes on the next sync; conversions sent through the UET Conversions API are not affected. |
Sign-in fails with AADSTS650052 ("The app is trying to access a service ... that your
organization lacks a service principal for"), or AxiTrace says the organization has not enabled
Microsoft Advertising |
You signed in with a Microsoft account from an organization (Microsoft Entra tenant) that does not use
Microsoft Advertising, often a work account the browser picked automatically. It is not an AxiTrace
or tenant-admin problem. Click Connect Microsoft Advertising again and, on the
Microsoft sign-in screen, choose Use another account and sign in with the account you
use at ads.microsoft.com. Sign out of the other Microsoft account first, or use a private
window, if Microsoft keeps picking it. |
| After Sign in with Google, AxiTrace says Microsoft Advertising has no user that signs in with this Google account | The Google account you picked is not the one your Microsoft Advertising user signs in with, or your
Microsoft Advertising user signs in with a Microsoft account. Check which button you use at
ads.microsoft.com: with Google, sign in again with that exact Google account (Google may
have picked another one you are signed in with); with a Microsoft account, use
Connect Microsoft Advertising instead (section 11). |
| Sign-in stops at Need admin approval | The Microsoft Entra tenant blocks user consent for third-party applications. A tenant admin opens the admin-consent link in section 11 once for the organization, then the connection can be completed normally. |
| Spend shows on a campaign but visits and orders land under Untracked | The Final URL Suffix is missing, or a URL tracking template strips query parameters, so the landing
URL carries no ms_campaign_id, ms_adgroup_id or ms_ad_id. Fix
the suffix (section 11) and wait for new clicks; old clicks are not re-matched. |
Microsoft does not document whether an event with no preceding ad click is visible on the goal at all, or after how long, so the row above describes what AxiTrace can prove (delivery) and does not promise what the goal will show.
Reporting latency
Because the timing is partner-reported rather than documented, do not use it to judge a setup on its first day.
The connection log is the fast signal: a 200 there means Microsoft has your event, whatever
Microsoft reporting shows so far.
Shopify
On Shopify the AxiTrace app pixel already sends every conversion to our servers, and the server leg above forwards them to Microsoft. The optional Microsoft UET Bridge Custom Pixel adds the browser half: it pushes UET custom events from inside Shopify's Customer Events sandbox and fires Microsoft ID Sync on every page view. Both legs carry the same Shopify event ID, so Microsoft deduplicates the pair (section 10).
It is needed on Shopify specifically because the Custom Pixel sandbox cannot see scripts pasted into your theme. The snippet therefore loads Microsoft's official UET base code itself, using your UET tag ID. On every other platform the AxiTrace web SDK does the same job with no snippet at all.
The snippet also sends UET Consent Mode, taken from your store's own Shopify customer
privacy state. It pushes ad_storage as granted only when Shopify reports that
the visitor's consent allows marketing, and as denied in every other case, including when
that state cannot be read; the default is pushed before the UET base code loads and updated the moment
the visitor answers your consent banner. So if your consent banner is integrated with Shopify's customer
privacy API, your Microsoft signals are correct for EEA, UK and Swiss visitors with nothing further to
configure (section 15).
The snippet reads your AxiTrace workspace consent policy once at runtime, so one switch governs it too. With Respect cookie consent on, it loads Microsoft's UET base code only after the visitor allows marketing, and holds every Microsoft-facing action until then: no request reaches Microsoft before the decision. With the switch off, the base code loads as it always has. You never paste a new snippet because of that setting: flip it in AxiTrace and the snippet follows within 5 minutes.
Setup
- Open your workspace's Microsoft Ads Conversions API connection page in the AxiTrace admin panel (Connections → Conversion destinations, then Settings on that card). A personalized version of the snippet, with your UET tag ID and your customer ID already filled in, is shown there once your UET tag ID is saved. Your Conversions API token is never part of the snippet.
- In your Shopify admin, go to Settings → Customer events.
- Click Add custom pixel and name it, for example "AxiTrace Microsoft UET Bridge".
- Paste the snippet into the code editor.
- In the Customer privacy box of the pixel, under Permission, choose Not required ("The pixel will always run"). With Required Shopify does not load the pixel at all until the visitor has granted the selected purposes, so declining or undecided visitors would get no Consent Mode signal and no bridge coverage while everything still looks "connected". Running the pixel unconditionally is what lets it report the visitor's real consent state to Microsoft (section 15): the snippet itself never sends anything Microsoft treats as personal data. This stays Not required even when your AxiTrace workspace requires cookie consent - the snippet does the gating itself, which is what lets it push the Consent Mode default before the tag loads. Leave Data sale at the value that matches your store's privacy policy.
- Click Save, then Connect.
What the snippet sends
| Shopify Customer Event | What the snippet does |
|---|---|
page_viewed | Microsoft ID Sync only. No UET event is pushed: AxiTrace sends no page-load events on either leg. |
product_viewed | UET custom event view_item |
product_added_to_cart | UET custom event add_to_cart |
checkout_started | UET custom event begin_checkout |
axitrace_lead | UET custom event generate_lead. This is a custom event your theme publishes when a visitor clicks an inquiry button; see below. |
Storefront inquiry button
If your store has an inquiry or "ask about this product" form rather than a checkout for that product,
you can report it as a lead. Publish one custom event when the inquiry form is submitted, with the email
the visitor typed, so the lead carries a match key. Paste this before </body> in
layout/theme.liquid and replace the form selector and field names with your theme's:
<script>
document.addEventListener("submit", function (e) {
var form = e.target;
if (!form || !form.matches("form.customer-inquiry-form__form")) { return; }
var v = function (name) { var el = form.querySelector("[name=\"" + name + "\"]"); return el && el.value ? String(el.value).trim() : ""; };
if (window.Shopify && window.Shopify.analytics && typeof window.Shopify.analytics.publish === "function") {
window.Shopify.analytics.publish("axitrace_lead", {
source: "product_inquiry",
product_id: v("productId"),
product_title: v("productTitle"),
email: v("email"),
phone: v("phone")
});
}
}, true);
</script>
Both the AxiTrace app pixel and the Custom Pixel receive that event. The app pixel forwards it to our
servers as a lead, which the server leg sends to Microsoft as generate_lead; the Custom
Pixel pushes the same generate_lead with the same event ID, so the two deduplicate.
Consent Mode and the browser tag
Consent Mode governs your own browser UET tag. It is separate from the AxiTrace server
leg, which carries its own adStorageConsent derived from your AxiTrace consent state
(section 9) and is unaffected by what the browser tag does. On your own pages, Consent Mode has to be
configured once, as high in the head as possible.
On Shopify you get it automatically. The AxiTrace Microsoft UET Bridge Custom Pixel
(section 14) derives Consent Mode from your store's Shopify customer privacy state: it pushes the
ad_storage default before the UET base code loads, defaulting to denied, and
pushes an update when the visitor answers your store's consent banner. granted is sent only
when your store's consent settings allow marketing for that visitor, so a merchant whose consent banner
is integrated with Shopify needs no extra Consent Mode script for the bridge.
Microsoft's own requirements, quoted from its Consent Mode FAQ:
"Microsoft Advertising requires advertisers using our Universal Event Tag (UET) to provide user consent signals, by implementing either Consent Mode for UET or the IAB's Transparency and Consent Framework (TCF) on their websites."
Consent Mode FAQ
"Either Consent Mode or TCF can be used with Microsoft Advertising, but you should never use both simultaneously."
Consent Mode FAQ
"Yes, UET must be loaded before the user interacts with the consent banner, but the default setting for Consent Mode must be set to Denied to prevent processing information without consent. Once the user gives consent, this setting should be updated to Granted. If consent is not given, the Denied setting will remain as is."
Consent Mode FAQ
"Ideally, the UET Consent Mode script should be placed as high as possible within the head section of the webpage. The default needs to be set before the page is fully loaded."
Consent Mode FAQ
"Currently, we are only planning to enforce consent based on the ad_storage value."
Consent Mode FAQ
"If you are using UET, but have not implemented Consent Mode or the TCF, then we will stop tracking your UET-based conversions and populating your remarketing lists."
Consent Mode FAQ
To check that your own tag reports consent, Microsoft says to
"check the asc parameter in the Page Load event once the UET tag is fired. This should be set to
"G" when consent is granted and "D" when consent has been denied", and that
window.uetq.uetConfig.consent.adStorageAllowed shows the current state in the browser
console
(Consent Mode FAQ).
adStorageConsent on its own Conversions API events, derived from the consent state
AxiTrace recorded for that visitor. Your AxiTrace workspace consent policy remains the master switch: an
event blocked there is never forwarded at all.
What the AxiTrace consent switch changes here
Respect cookie consent (Workspace → Settings) governs what AxiTrace itself does in the browser. While it is off, nothing on this page is restricted: the UET bridge pushes its events and Microsoft ID Sync fires on every page view, exactly as before. While it is on:
- Microsoft ID Sync needs marketing consent. The sync request sets Microsoft's own MUID cookie, which is a third-party cookie write, so it is suppressed entirely until the visitor allows marketing. There is no anonymous variant.
- UET event pushes from the AxiTrace SDK (the browser half of the deduplicated pair) are suppressed the same way, and are never queued for a later retry.
- A withdrawal deletes the cached Microsoft customer id along with AxiTrace's own identifiers.
If your site uses an IAB TCF consent platform that reports that GDPR applies, a plain marketing grant is not enough for these two Microsoft side effects. AxiTrace additionally requires Microsoft's TCF vendor id 1126 and the purposes Microsoft names:
| Microsoft side effect | TCF vendor | TCF purposes required |
|---|---|---|
| UET conversion push from the SDK | 1126 | 1, 7, 9 and 10. Microsoft states it requires purposes 9 and 10 for all conversions, and that a missing purpose means the conversion is not recorded. |
| Microsoft ID Sync | 1126 | 1, 3 and 4: device storage plus personalisation and remarketing, which is what the MUID cookie is for. |
A TCF platform reporting gdprApplies === false is outside the TCF regime, so the marketing grant
alone is enough there. Full details of the switch and of every consent signal AxiTrace reads are in the
Cookie consent guide.