Tag installation
Where the tag goes, how to tag destination URLs, and how to handle the subdomain and cross-domain cases.
Getting the campaign tag#
In the Moclick dashboard, under Campaigns → Scripts, every campaign has its tag ready to copy. The support team can also send it to you directly.The global tag#
Add it to the<head> of every page on the site,
including the order confirmation page:
HTML<head>
<script src="https://bridge.moclick.com.br/moclick-YOUR-SLUG.js" defer></script>
YOUR-SLUG with the campaign identifier. It is part of the tag URL,
and that is why there is no extra configuration: the campaign is identified by the
script address itself.
What the tag does on load#
- Fetches the campaign configuration (5 s timeout)
- Captures the click identifiers from the URL and writes them to first-party cookies
- Records the visit, when the campaign uses Moclick’s own measurement
- Starts watching
window.MoclickConversion
Renaming the campaign invalidates the installed tagThe identifier comes from the campaign name. Changing the name in the dashboard
changes the identifier, and the tag already installed on the site
stops resolving — with no visible error, it simply stops tracking.
When renaming a live campaign, send the new tag to the client before publishing the
change.
Tagging the destination URL#
When Moclick runs the media, tracking links already arrive tagged and there is nothing to do. When the advertiser runs the campaign and wants it to show up in the Moclick dashboard, the destination URL has to carry the tagging parameter:Destination URL
// Simple tagging https://loja.com.br/oferta?mclk=1 // The value identifies the source in the dashboard https://loja.com.br/oferta?mclk=busca https://loja.com.br/oferta?mclk=social
Final URL suffix
mclk=SOURCE-IDENTIFIER
Untagged traffic never reaches the dashboard — organic, direct and untagged sources
are excluded by design. The dashboard measures tracked media, not total site
sessions. If you need to measure a specific source, ask the Moclick team for the
right parameter for that campaign.
Subdomain and cross-domain#
The most common cause of a lost conversion: the store lives on a different host from the site that received the click.Subdomains of the same domain#
Example: click onwww.marca.com.br, checkout on
loja.marca.com.br. The tag infers the cookie domain by walking up the
hostname hierarchy and usually resolves it on its own. If the cookie stays pinned to the
host, force the domain by declaring the configuration before the tag:
HTMLbefore the global tag
<script> window.MoclickConfig = { campaign_slug: "your-campaign", cookie_domain: ".marca.com.br" // leading dot: valid for every subdomain }; </script> <script src="https://bridge.moclick.com.br/moclick.js" defer></script>
| Key | Type | Required | Description |
|---|---|---|---|
campaign_slug |
string | Yes | Campaign identifier. |
cookie_domain |
string | No | Forces the cookie domain. Without it the tag infers the domain automatically. |
cookie_domain on every host involved, and
install the global tag on all of them.
Different domains#
Example: click onmarca.com.br, checkout on
pagamento-terceiro.com. Cookies do not cross separate domains. Two ways
out:
- Propagate in the URL: pass the click identifier along as a parameter when redirecting to the second domain, and install the global tag there too. The tag reads the parameter and rewrites the cookie on the new domain. The Moclick team tells you which parameter your campaign uses.
- Postback S2S: the advertiser’s backend reports the conversion server-to-server, with no dependency on cookies or JavaScript. This is the most robust option. See Postback S2S.
Frequent mistakeInstalling the tag only on the confirmation page. Without the tag on
the landing pages, the click identifier is never captured from the URL and no
conversion is ever attributed — nothing gets recorded, and there is no console error
to warn you.