Run
Analytics and ad tools
Google Analytics, ad pixels, session recording, and more on every page, from an ID or a snippet.
Mockly adds the tools you already use to measure and advertise: analytics, ad pixels, and session recording. Pick one in Site settings, give it the ID the tool shows you, and every published page loads it. You don't write a <script>: pages can't have one, and Mockly adds each tool's own snippet for you.
Adding a tool#
Open Site settings in the editor's sidebar, and under Tracking tools, click Add a tool…. Pick it from the list, or search for it. Its card asks for its ID:
- Type the ID, such as
G-PSW1MY7HB4for Google Analytics, and press Enter, or leave the field. It's written the way the tool writes it, sog-psw1my7hb4is fine. - Or paste the tool's whole snippet, the code it tells you to put on your site. Mockly reads the ID from it, and for tools with regions, where the snippet sends data. The card says Read from the snippet you pasted.
The ⓘ beside the field says where the tool shows its ID, and the card's ⋯ menu links to the tool's own help on finding it. An ID that isn't the tool's says so under the field, with what one looks like. A tool you picked isn't the site's until its ID is in.
Changes save as you make them, and reach the live site with your next publish. Until then, they count as unpublished changes, and the publish plan lists them. Each version keeps its tools, so History shows when they changed, and restoring a version brings its tools back.
To remove a tool, open its card's ⋯ menu and choose Remove.
The tools#
| Tool | What it asks for |
|---|---|
| Google Analytics | Measurement ID, G- and letters and digits |
| Google Tag Manager | Container ID, GTM- and letters and digits |
| Google Ads | Conversion ID, AW- and digits |
| Meta Pixel | Pixel ID, digits |
| LinkedIn Insight Tag | Partner ID, digits |
| TikTok Pixel | Pixel ID |
| X Pixel | Pixel ID |
| Reddit Pixel | Pixel ID, a2_ and letters and digits |
| Pinterest Tag | Tag ID, digits |
| Snap Pixel | Pixel ID |
| Microsoft Clarity | Project ID |
| Hotjar | Site ID, digits |
| Segment | Write Key |
| PostHog | Project token, phc_ and letters and digits, and its region, US or EU |
| Mixpanel | Project Token, and its region, US, EU, or India |
| Amplitude | API Key, and its region, US or EU |
| Plausible | The pa-… part of your site's script address |
| Fathom Analytics | Site ID |
Google Analytics and Google Ads share Google's tag: with both, it loads once, set up for each. Each tool sees every page view, as it would with its snippet in your pages.
Goals and experiments#
Mockly sends your site's goals and experiments on to the tools too, so your own analytics can split by variant, and your ads get credit for conversions.
Analytics tools get everything. Every goal, with its value, and which variant of each experiment a visitor saw, in each tool's own format:
| Tool | Goals | Experiments |
|---|---|---|
| Google Analytics | An event of the goal's name, with dashes as underscores: cta-click is cta_click | experience_impression, with exp_variant_string mockly-hero-copy-bold, the first time a visitor sees a variant |
| Google Tag Manager | mockly_goal in the data layer, with mockly_goal, value, and currency | mockly_experiment, with mockly_experiment and mockly_variant |
| PostHog | An event of the goal's name | $feature/hero-copy on every event, and experiment viewed, which a PostHog experiment can use as its exposure |
| Mixpanel | An event of the goal's name | $experiment_started, for Mixpanel's Experiments report |
| Amplitude | An event of the goal's name | A [Mockly] hero-copy user property, and Experiment Viewed |
| Segment | A track call of the goal's name | Experiment Viewed, as Segment's A/B testing spec has it |
| Plausible | A custom event, with its value as revenue | Experiment viewed, with the experiment and variant |
| Fathom Analytics | An event, with its value | An event named experiment hero-copy bold |
| Microsoft Clarity | A custom event | A custom tag per experiment, to filter recordings by variant |
| Hotjar | An event | An event per experiment, hero-copy:bold |
Plausible shows a custom event once a goal of its name is set up in Plausible. To keep a tool from getting them, turn off Goals and experiments on its card.
Ad tools get the goals you pick. On an ad tool's card, under Conversions, click Add a conversion, pick one of your site's goals, and the tool's event for it: signup as Meta's Lead, purchase as Purchase. Google Ads, LinkedIn, and X make an ID for each conversion instead: paste it, or the code the tool gives you for it, and Mockly reads the ID. Ad tools don't get experiments.
Values. A goal's value, from track("purchase", total) or mk_value on a thank-you page, goes with it, in the currency under Goal values are in. LinkedIn takes a conversion's value from its own settings.
When they're sent. A goal goes to the tools when Mockly counts it: a click, a form's sign-up (never spam), or a visit to a page with a goal (not again when it's reloaded). An experiment goes the first time a visitor sees a variant, for the tools that count exposures, and on every page for those that tag pages or sessions. A check with forced variants sends nothing.
Where they run#
Tools run on the published site, on every page, the not-found page too, for every visitor. They never run in the editor's preview or on a share link, so your drafts and the people reviewing them don't show up in your analytics.
Mockly doesn't ask visitors for consent yet. Plausible and Fathom don't set cookies. For the others, check what each one sets, and what the laws where your visitors are ask of you before it does.
Security#
Published pages run only their own scripts, under a strict Content-Security-Policy. A site with tools lets in what those tools load and send data to, from each vendor's guide and what its scripts do, and nothing else. Other sites, and a site without tools, keep the strict policy.
Google Tag Manager is the exception. It runs whatever tags its container holds, which no list of origins can cover, so a site with it allows scripts from any https site, inline scripts, and eval. Its card and the list say so. Add the tools you need here instead, where you can, and keep Tag Manager for what only it does.