Skip to content

Add the MarkTag to your web application

  1. Install and init MarkTag Script to your web application
html
<script>
  window.mtrem = window.mtrem || [];
  function mtag() {
    mtrem.push(arguments);
  }
  mtag("init", "{{TAG_DOMAIN}}?tagId={{TAG_ID}}", { consent: true });
  mtag("event", { type: "ViewContent" });
</script>
<script async type="text/javascript" src="{{TAG_DOMAIN}}/script"></script>

Make sure to replace and with your marktag domain and Tag ID from https://beta.markopolo.ai/ or the Partners API.

Done! You are now able to log events with MarkTag. The ViewContent event will fire immediately when the page loads, tracking page views across your site.

The consent parameter in the initialization should be controlled by your existing consent management system if you have one. We recommend integrating this with your consent banner:

javascript
// Example: Integration with your consent management
const userConsent = getUserConsentStatus(); // Your consent logic
mtag("init", "{{TAG_DOMAIN}}?tagId={{TAG_ID}}", { consent: userConsent });

⚠️ Legal Notice: In most jurisdictions, setting consent: true in production without obtaining actual user consent may not be legally compliant. Always follow local privacy laws (GDPR, CCPA, etc.) when implementing tracking.

MarkTag also ships with a built-in consent banner so you don't have to build your own — see Consent Banner for how to enable it and its full runtime API.