Tráfico

Tráfico de referidos de IA

Instala el snippet, atribuye visitas de asistentes de IA y lee los datos en la API pública v2.

AI referral traffic

Measure visits that arrive on your domain from ChatGPT, Gemini, Claude, Perplexity, Copilot, and other AI assistants.

MencionAI already tracks whether models cite or recommend your brand. AI referral traffic answers a different question: did humans click through to your site?

How it works

  1. Create a site key in Settings → AI Traffic (or the AI traffic script accordion under API Keys).
  2. Paste the install snippet on your site (or load it via Google Tag Manager / RD Station).
  3. The snippet posts document.referrer and optional UTMs to Public API v2 POST /v2/traffic/ingest.
  4. Command Center and the API show visits by AI source.

Important: ChatGPT and Gemini usually do not append UTMs. Attribution relies on the HTTP referrer when present. Some clicks arrive as Direct (“dark AI traffic”) and will be under-counted.

Install snippet

Copy the ready-made snippet from Settings → AI Traffic. It looks like:

<script
  async
  src="https://www.mencionai.com/t.js"
  data-site="YOUR_SITE_KEY"
  data-endpoint="https://api.mencionai.com/v2/traffic/ingest"
></script>

Replace YOUR_SITE_KEY with the full msk_… value from Settings (or copy the block already filled in for you).

Verify

  1. Open your site with DevTools → Network.
  2. Confirm a POST to /v2/traffic/ingest returns 200.
  3. In Settings → AI Traffic, use Check install, or wait until status shows Receiving traffic after the first successful ping.

  1. Tags → New → Custom HTML.
  2. Paste your snippet from Settings.
  3. Trigger: All Pages (or the pages you want to measure).
  4. Submit and publish the container.
  5. Use GTM Preview to confirm the tag fires.

Plain HTML / header

Paste the snippet before </head> on every template you care about (or in a shared layout partial).

Next.js (App Router)

In app/layout.tsx (or your root layout):

import Script from 'next/script';

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        {children}
        <Script
          src="https://www.mencionai.com/t.js"
          strategy="afterInteractive"
          data-site="YOUR_SITE_KEY"
          data-endpoint="https://api.mencionai.com/v2/traffic/ingest"
        />
      </body>
    </html>
  );
}

If data-* props are awkward with next/script in your version, use a raw <script async …> in the layout instead.

WordPress

Very common for Brazilian content and lead-gen sites.

  • Theme: paste into header.php before </head>, or
  • Plugin: use “Insert Headers and Footers” / WPCode / similar, or
  • GTM: load via your existing Tag Manager plugin (then follow the GTM steps above).

Publish/clear cache (LiteSpeed, WP Rocket, Cloudflare) after installing.

Shopify

  • Online Store → Themes → Edit code → theme.liquid → paste before </head>, or
  • Settings → Customer events / additional scripts if your plan supports it.

Webflow

Project Settings → Custom Code → Head Code → paste the snippet → Publish.

React / Vite SPA

Add the snippet to index.html inside <head>, or inject once in your app bootstrap so it runs on first load.

RD Station Marketing

Common in Brazil when the marketing team already injects tags.

  1. Open RD Station → settings for site tracking / custom scripts (or your GTM container linked to RD Station).
  2. Add a custom HTML / custom script block with the MencionAI snippet (same as GA4 or Meta Pixel installs).
  3. Apply to all pages (or the funnel pages you care about).
  4. Publish and verify with Network → POST …/traffic/ingest.

If RD Station only hosts GTM for you, install via Google Tag Manager instead.

ActiveCampaign / other tag managers

Same pattern as GTM or RD Station: Custom HTML / custom script on All Pages. Do not put organization API keys (mak_…) in the browser.


Brazil ecommerce platforms

Nuvemshop (Tiendanube)

  1. Admin → Online storePreferences / Scripts (or My apps → custom code, depending on plan).
  2. Paste the snippet in the header / head scripts field.
  3. Save and open the storefront once to verify ingest.

If your plan only allows apps: install via Google Tag Manager connected to the store.

Loja Integrada

  1. Admin → LayoutCódigo HTML / Scripts (or Configurações → custom codes).
  2. Paste the snippet in the head section.
  3. Save, clear any cache, and verify Network → ingest.

Tray Commerce

  1. Admin → ConfiguraçõesCódigos e SEO / Scripts personalizados (labels vary by Tray version).
  2. Add the snippet to the header.
  3. Save and test on the live storefront.

VTEX

  1. Use Google Tag Manager (most common on VTEX IO / CMS), or
  2. Storefront / CMS custom HTML in the head for the pages you measure, or
  3. A pixels/scripts app if your account already centralizes third-party tags there.

Prefer sitewide GTM so checkout and landing templates stay covered.

Magento / Adobe Commerce

  • Add the snippet in the theme default_head_blocks.xml / head template, or
  • Use a “Custom Scripts / Magento GTM” extension and install via GTM.

Wix / Landpages (Hotmart, Eduzz, Braip, etc.)

  • Wix: Settings → Custom Code → Head → All pages → paste snippet.
  • Checkout / member landpages: if the platform allows “custom head / tracking pixels”, paste the same snippet; otherwise load it from GTM on those domains (register the landpage domain as your project domain or a matching allowlisted host).

Privacy note

The MVP snippet is cookieless (sessionStorage only, no raw IP in the product path). Your legal/consent banner policy still applies if you combine it with other marketing tags.


API v2

| Method | Path | Auth | | --- | --- | --- | | POST | /v2/traffic/ingest | Site key (msk_…) in body or X-MencionAI-Site-Key | | GET | /v2/workspaces/{id}/traffic/summary | API key + workspaces:read | | GET | /v2/workspaces/{id}/traffic/series | API key + workspaces:read | | POST | /v2/workspaces/{id}/traffic/site-key | API key + workspaces:write |

Never put organization API keys (mak_…) in the browser snippet.