company logo

Help center

Check Out Boxly's Quick Start Video Guides
All collectionsMarketingAttribution Tracker: Guide for Marketing Agencies

Attribution Tracker: Guide for Marketing Agencies

How to set up the Attribution Tracker for the practices you work with and what it shows them

πŸŽ₯ Watch how to set up website attribution:

What It Does

The Boxly Attribution Tracker is one script on your client's website. It records where each visitor came from and attaches it to their enquiry in Boxly, without relying on the form passing the page URL.

That means:

  • Leads stop showing as Direct Traffic when the form doesn't pass the URL

  • Visitors who leave and come back later keep their original source (for up to 60 days, less in Safari and on iPhones)

  • Boxly sends conversions back to the client's connected Google Ads and Meta accounts with the click ID attached.

It doesn't replace your UTMs. Keep tagging your ad links as normal: Safari can strip click IDs from ad links but leaves UTMs alone, so UTMs keep the campaign when the click ID is lost.

Setting this up for a practice?
Our help article, Attribution Tracker: Understand Where Your Leads Come From, explains the setup from the practice's side, including how to choose an attribution model.

What You Need to Do

1. Install the script

The practice sends you their script from Boxly (Settings β†’ Lead Management β†’ Attribution β†’ Email the script to your developer). Each practice has its own script. Use it only on that practice's websites and don't share it.

Already running Boxly's GA4 client ID script? The Attribution Tracker reads the GA4 client ID itself, so remove the older script when you add the tracker.

Add it once to every page, just before the closing </body> tag. Your site's shared header or footer is the easiest place.

2. Connect cookie consent

The tracker only runs after the visitor gives consent. It picks up these consent tools automatically:

CookieBot, CookieYes, OneTrust, Borlabs Cookie, Civic Cookie Control, Complianz, IAB TCF v2.0.

Using something else? Your consent tool needs to tell the tracker when a visitor accepts or withdraws consent. The exact lines to add are in the email from Boxly, and in Boxly under Consent & events β†’ Cookie consent.

Without a consent signal, nothing is tracked. The enquiry still reaches Boxly, just with no attribution data.

3. Add custom events (optional)

The tracker records form submissions and WhatsApp link clicks on its own. For anything else, such as a chat widget opening or a booking completion, you can send a custom event with a short event name and optional extra detail. The code to use is in the email from Boxly, and in Boxly under Consent & events β†’ Custom events. A new event shows in the practice's reporting within a few minutes of its first firing.

4. Check it's working

Ask the practice to open Settings β†’ Lead Management β†’ Attribution. The status card should show Script detected and a recent Last visitor. After a test enquiry from a tagged URL, Leads linked goes up.

If the card shows No visitors in the last day, check the script is on every page and that consent is reaching the tracker.

What It Captures

Data

Used for

First landing page URL, including UTM parameters

Lead source and UTM reporting in Boxly

Ad click IDs: Google, Meta (Facebook), Microsoft and TikTok

Matching the lead to the ad; Google and Meta conversions are sent back with the click ID

GA4 client ID

Matching Boxly leads to GA4 sessions

Form submissions and WhatsApp link clicks

Tying the enquiry to the visit

Custom events

The practice's reporting

Conversions only go back to Google Ads and Meta when the practice has those accounts connected in Boxly. Microsoft and TikTok click IDs are used for source reporting in Boxly only.

New sources are added as Lead Sources. If the tracker finds a source the practice doesn't have in Boxly yet (for example their Google Business Profile), Boxly creates it as an unpaid Lead Source and assigns it to the lead. If the Lead Source already exists, Boxly uses it, so there are no duplicates.

Attribution Model

The tracker stores every touchpoint it sees for a visitor. The attribution model decides which one gets the credit for the lead in Boxly's reports. The practice sets it in Settings β†’ Lead Management β†’ Attribution β†’ Attribution Model, and it can be changed once an hour.

Model

Who gets the credit

Use it to answer

First touch

The first interaction gets 100% of the credit

Which campaigns bring new patients to the practice?

Last touch

The last interaction before conversion gets 100% of the credit

Which campaigns get patients to enquire?

Example: A patient clicks the practice's Google Ads Invisalign campaign on Monday. On Friday, they come back by typing the web address in and fill in the form.

  • First touch: the lead is credited to the Google Ads Invisalign campaign.

  • Last touch: the lead is credited to their last visit before they enquired, on Friday.

  • Either way, the Monday ad click is captured, so the journey isn't lost as Direct Traffic.

What the model does and doesn't change

  • Changes: the lead's source and campaign in Boxly's reports (Lead Sources, UTM Reporting, Ad Spends).

  • Doesn't change: what Boxly sends to Google Ads and Meta. Boxly sends the conversion with the click ID it holds, and each platform credits it using its own attribution settings. Your Google Ads and Meta reporting may therefore credit a different campaign from Boxly's report, which is expected.

Which should the practice use? Boxly recommends First touch for most practices. It credits the campaign that first brought the patient to the site, even when they enquire days later. Last touch suits retargeting or remarketing, where you want to see what brought the patient back to enquire.

Good to Know

Most enquiries are tracked from start to finish. These are the cases where the tracker can't see the full journey, and what to do about each one.

Situation

What happens

What you can do

Phone calls

The tracker runs in the browser, so it never sees a call. Calls and taps on a phone number aren't tracked.

Ask the practice's phone or call-tracking provider to send the call's source to Boxly through the Phones API. The API accepts the gclid and the landing page URL with each call. The provider usually captures these with its own number swapping (DNI).

Patients who come back later

The tracker remembers a visitor for 60 days from their last visit. Each new visit starts the 60 days again. If they don't visit for 60 days, their next visit is treated as new. 

Nothing to set up. For long decision journeys (for example implants), expect some leads to show the more recent source.

Forms inside an iframe, or built as the page loads

The tracker adds its data to the form when it's submitted. If the form sits in an iframe (some booking widgets and embedded third-party forms), or is created by a script after the page has loaded, the tracker may not reach it.

Submit a test enquiry from each form type on the site and check the lead in Boxly shows a source. If one doesn't, tell support which form it is.

Safari, and every browser on iPhone and iPad

These browsers block the cookie Boxly normally uses. This covers all iPhone and iPad browsers (Chrome included, as they use Safari's engine), Safari on Mac, the Facebook and Instagram in-app browsers, Brave and private or incognito windows. The tracker recognises a returning visitor only if they come back within 7 days of their last visit. A longer gap is treated as a new visitor. Newer Safari versions also strip gclid and fbclid from ad links (UTMs are kept). Many consent tools clear the visitor's choice after 7 days too, so the visitor sees the banner again and isn't tracked until they accept.

Nothing to fix in the setup. Always tag ad links with UTMs, so the campaign is still recorded when the click ID is stripped. Google Ads and Meta can still match some of these conversions using the hashed email and phone number Boxly sends.

Different devices

The tracker works per browser. If a patient clicks an ad on their phone and enquires later on a laptop, the two visits can't be linked.

As with Safari, the hashed email and phone number Boxly sends help Google Ads and Meta match some of these.

Ad blockers and strict site security

Some ad blockers, or a website security setting that blocks outside scripts (Content Security Policy), stop the script loading. Nothing is recorded for that visitor.

If Script detected doesn't appear in Boxly, check whether the site's security settings allow the Boxly script. Ad blockers are on the visitor's side and can't be changed.


FAQs

One script per website or per account?

Per Boxly account. Add the same script to every website whose enquiries come into that account.

Do we still need to pass the page URL in forms?

Not for attribution once the tracker is installed, but leaving it in does no harm.

Why are more iPhone leads showing as Direct Traffic?

Safari and every iPhone browser only let the tracker recognise a returning visitor within 7 days of their last visit and they can strip click IDs from ad links.

Does the practice need to be on a particular plan?

Does the practice need to be on a particular plan? Yes. The Attribution Tracker is part of Boxly's Pro plan.

Who do we contact with questions?

You can reach out to us at [email protected].

Did this answer your question?
😞
😐
😁