Skip to content
NMC Docs

Tracking code

Install nmc.js and review its Content Security Policy, cookie, and Google Ads URL parameter behavior.

On the business’s Tracking page, choose View code on the Tracking code card, then Copy code. The snippet uses a public business ID and never needs a business API key:

<link
rel="preconnect"
href="https://website.nomissedconversions.com"
crossorigin
/>
<script
async
src="https://cdn.nomissedconversions.com/nmc.js"
data-nmc-business="YOUR_BUSINESS_ID"
></script>

Add the snippet to the shared <head> across the pages you want to track, replacing YOUR_BUSINESS_ID with the business ID from NMC. Make sure the business’s website URL is set in NMC, choose Check my website after publishing, and test and enable each form separately.

The preconnect link lets the browser connect to NMC while the page loads, so visitors see tracking numbers sooner. Keep its crossorigin attribute: nmc.js sends its requests without cookies, and without crossorigin the browser opens a connection those requests can’t use.

async keeps your site’s own scripts from waiting on nmc.js, so a slow connection to NMC never holds up your menus or forms. nmc.js waits until the browser has finished reading the page’s HTML before it asks NMC for numbers, so it finds every number on the page. A returning visitor’s saved tracking numbers go in while the page is still being read.

A returning visitor can sometimes see your website phone for a moment before their tracking number replaces it. If you notice this, add fetchpriority="high" to the script tag:

<script
async
fetchpriority="high"
src="https://cdn.nomissedconversions.com/nmc.js"
data-nmc-business="YOUR_BUSINESS_ID"
></script>

This asks the browser to run nmc.js sooner, so the saved number can go in before the page first appears. The tradeoff is that nmc.js loads ahead of some of your site’s other files, but it’s under 6 KB, so that shouldn’t be noticeable. The attribute can’t block your page, and browsers that don’t support it ignore it.

It doesn’t change the first page of a visit. Nothing is saved yet, so your website phone shows until NMC answers.

If your site sets a Content-Security-Policy header, add these two origins while keeping the sources your site already allows:

  • Scripts (script-src, or script-src-elem if present): https://cdn.nomissedconversions.com
  • Requests (connect-src): https://website.nomissedconversions.com

nmc.js sends browser events to the public website service at website.nomissedconversions.com rather than the authenticated /v1 customer API. During form testing, it also loads setup.js from cdn.nomissedconversions.com to display the “NMC test mode” banner; check the browser console if your CSP blocks the test helper.

  • Visits and forms: nmc.js records the page URL and referrer. From that page URL, NMC reads gclid, gbraid, wbraid, the five standard utm_* parameters, and NMC’s Google Ads click parameters when present, and, on visits carrying a Google click ID, the campaign from Google’s gad_campaignid query parameter. When a visitor submits an enabled form, nmc.js records the configured form fields.
  • Background tabs: nmc.js waits until the page is visible on screen before recording a visit, setting cookies, or swapping phone numbers. A page opened in a background tab does nothing until the visitor views that tab.
  • First-party cookies and browser storage:
    • _nmc_anonymous_visitor_id: First-party visitor cookie set with a 400-day maximum age and refreshed on use (browsers may enforce shorter retention limits).
    • _nmc_cookie_probe: Temporary cookie written to find the writable cookie domain and deleted immediately after the check.
    • nmc-numbers:<business ID>: Stores in localStorage the tracking numbers last shown to this visitor and when NMC was asked for them, so the next page shows them straight away instead of the website phone. Numbers older than 30 minutes are ignored, and each page’s answer from NMC replaces them.
    • Form test mode: Stores the test token in the tab’s sessionStorage and records no visit, sets no cookies, and swaps no phone numbers.
  • Google Analytics cookies: If Google Analytics runs on the site, nmc.js reads Google Analytics’ own _ga and _ga_* cookies and sends their values with each page view and form submission. NMC uses them only to send lead events to the Google Analytics property connected for that business.

When a business connects Google Ads, NMC appends these ValueTrack parameters to the Final URL suffix at the account, campaign, ad group, ad, keyword, and sitelink levels, and Google fills in each value when someone clicks an ad. NMC preserves any other parameters in your suffix and updates only parameters whose names start with nmc_, so avoid using the nmc_ prefix for your own custom parameters.

Parameter What Google fills in
nmc_ad_group_id={adgroupid} The ad group ID.
nmc_ad_id={creative} The ad ID.
nmc_asset_group_id={assetgroupid} The asset group ID, for Performance Max.
nmc_keyword={keyword} The keyword from the account that matched the search. Blank when no keyword matched.
nmc_match_type={matchtype} The keyword match type: e Exact, p Phrase, b Broad, or a AI Max (no keyword).
nmc_network={network} Where the ad showed: g Google Search, s Search partners, d Display, ytv YouTube, vp Google video partners, gtv Google TV, x Performance Max, or e app campaigns for engagement.
nmc_device={device} The device: m Mobile, t Tablet, or c Computer.
nmc_target_id={targetid} The ID of the keyword, audience, or other target that showed the ad.

NMC displays these values under Google Ads click on the activity and lead pages (any unrecognized code is shown exactly as Google sent it). When NMC has imported the campaign name from ad results, the campaign from gad_campaignid appears by name under Google Ads click on the activity page and as Campaign under Details on a Google Ads lead.

Add these attributes to any element on your site. Each one covers the element and everything inside it:

  • data-nmc-noswap: NMC never swaps phone numbers inside it: not in its text, its tel: links, or its links that start a text. Use it on a footer or contact block whose name, address, and phone number must match your Google Business Profile. NMC never swaps numbers inside <script>, <style>, <noscript>, or <textarea>, so structured data such as JSON-LD keeps your real number without the attribute.
  • data-nmc-ignore: NMC never records fields inside it, and they don’t count toward identifying a form. On a <form>, or an element around one, NMC never records that form.

Load nmc.js in accordance with your site’s consent rules. When blocked, the tracking code can’t record visits, swap phone numbers, or record form submissions. If you load nmc.js behind a consent banner or through a tag manager, NMC’s automated connection check may not see the script; open the live site in a browser and allow tracking to verify the connection instead.

Once live, test the published site, place a test call to a swapped tracking number, and test each enabled form. For step-by-step installation instructions written for site owners, share the website guide.