Ir al contenido

Los artículos de ayuda existen en alemán e inglés. Aquí los lees en inglés.

Instalación

What does the tracking SDK offer?

The SDK provides init, setConsent, page, track, identify, conversion, goal and reset, plus paymentReference for Stripe and PayPal, fillForm for forms, and renderSurvey and survey for the post-purchase question. It loads asynchronously, queues calls made before it loads, and sends events in batches.

Which JavaScript calls are available?

metrunio.init({ siteId, writeKey, endpoint, consent, autoPageviews, testMode, debug });
metrunio.setConsent({ analytics: true, marketing: true });
metrunio.page({ area: 'home' });
metrunio.track('add_to_cart', { product: 'abc', price: 24.9 });
metrunio.identify('customer-4711');
metrunio.conversion({ orderId: '12345', value: 149.9, currency: 'EUR' });
metrunio.goal('shop_created'); // funnel step, counts once per customer
metrunio.paymentReference(); // reference for Stripe and PayPal, only with consent
metrunio.renderSurvey('#metrunio-frage', { orderId: '12345' }); // post-purchase question on the thank-you page
metrunio.survey({ orderId: '12345', answer: 'podcast_radio' }); // answer from your own interface
metrunio.fillForm('#enquiry'); // lead ID and origin into the form
metrunio.reset();

Behaviour

  • Asynchronous loading; calls made before it loads go into window.metrunioQueue and are replayed afterwards.
  • Batched sending: ten events or 1.5 seconds by default; navigator.sendBeacon when the page unloads.
  • Up to three retries with backoff; after that the batch stays local and is resent on the next page view.
  • The event ID is created before sending, so retries stay idempotent.
  • Without marketing consent, advertising events never leave the device.
  • No fingerprinting: the pseudonymous ID is a random first-party value in local storage.
  • A custom event gets its name through event_name: metrunio.track('custom', { event_name: 'newsletter_signup' }). Letters, digits and _ . : -, at most 64 characters; that is how it appears in a journey’s visit history.

Console error codes

CodeMeaning
CONFIG_INCOMPLETEsiteId, writeKey or endpoint missing, or the placeholder still stands in place of the write key
DOUBLE_INITinit() called a second time, usually because of a double installation; the first call applies
NOT_INITIALIZEDcall before init()
CONVERSION_ORDER_ID_MISSINGpurchase without an order number
GOAL_KEY_MISSINGfunnel step without a key
GOAL_KEY_INVALIDkey with spaces, accented letters or special characters other than _ . and -, or longer than 64 characters; the SDK lowercases capital letters itself

Note

debug: true logs every SDK decision to the browser console. That is particularly useful for seeing why an event was not sent for lack of consent.

Revisado por última vez el 13 oct 2026

También se pregunta

  • JavaScript API
  • metrunio.track
  • How do I send a custom event?
  • SDK documentation

Artículos relacionados

  • How do I install the code snippet?

    How do I install Metrunio without a tag manager?

    The finished code block is in the portal under “Setup → Snippet” and contains site ID and collector address. You see the write key only once, when it is created; if it is no longer known, the code carries the placeholder YOUR_WRITE_KEY and a button next to it creates a new one. The block belongs immediately before the closing head tag and loads asynchronously.

  • How do I measure a single-page app?

    What do I do if route changes without a reload are not counted?

    With automatic page views (autoPageviews, on by default) the SDK also counts route changes without a reload: it notices every address change through pushState, replaceState and the back button. Call metrunio.page() yourself only if your router switches views without changing the address, or if you have turned autoPageviews off.

  • Which events does Metrunio measure?

    Which event types exist and what consent do they need?

    There are fifteen event types. The four advertising events require marketing consent, all others at least analytics consent; without matching consent an event is not stored. The only exception is purchases and refunds your server reports without consent: they count for revenue reconciliation with their order number, without browser, customer or advertising identifiers, and are not attributed; after a refusal this only applies with an activated additional instruction.

  • How do I report a funnel step?

    How do I send the steps of my funnel from the browser or the backend?

    In the browser with metrunio.identify(userId) once after sign-in and then metrunio.goal('key') per step; from the backend with POST /v1/server/events and an event of type goal carrying goal_key and user_id. Both routes are equivalent; a step without a customer identifier is rejected.

  • How do I ask customers after a purchase how they found me?

    Can Metrunio ask after a purchase how someone heard about us?

    With the post-purchase question, on every plan. You switch it on under “Settings → Measurement rules” and call metrunio.renderSurvey() with the order number on your thank-you page. The answers appear as “self-reported” under “Channels & attribution”: next to what is measured, never in revenue and never in an attribution.

  • How does the origin of an enquiry get into my CRM?

    Can Metrunio write source, campaign and an identifier into my contact form?

    Through your form, on every plan: give it the attribute data-metrunio-lead, and with consent to analytics the SDK fills the fields metrunio_lead_id, metrunio_source, metrunio_medium, metrunio_campaign, metrunio_click_id and metrunio_click_platform; without consent they stay empty unless you switch on “Source without consent as well” for the site. With the lead ID, the offline import finds the later deal from your CRM in the journey.

Mira lo que cuentan tus datos.

Echa un vistazo primero a la demo. Por ahora, solo hay cuenta propia con invitación.

Abrir la demoSolicitar acceso