Install Median's Google Tag Manager Template
Before you get started you need:
- A Median app
- Create one here if needed
- A GTM container ID. To create one:
- Create a Google Tag Manager Account and Web Container
- Make sure you select Web for the container platform
- Copy your container ID
- Create a Google Tag Manager Account and Web Container
Upload custom JavaScript snippet in the App Studio
- On line 1 of the snippet below, replace
ENTER-GTM-ID-HEREwith your GTM container ID and copy the snippet to your clipboard
var gtmId = 'ENTER-GTM-ID-HERE';
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' });
var checkReady = setInterval(function () {
if (document.body) {
clearInterval(checkReady);
var f = document.getElementsByTagName('script')[0];
var j = document.createElement('script');
j.async = true;
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + gtmId;
f.parentNode.insertBefore(j, f);
}
}, 50);- In the App Studio:
- Head over to the Web Overrides page
- In the Custom JavaScript section (iOS and Android), paste the snippet from your clipboard. Make sure your GTM container ID is on line 1.
- Click Save
- Head over to the Build & Deploy page and rebuild your app

App Studio- Paste Custom JavaScript Snippet
Import Median's Tag template in GTM
-
Download the template's
.tplfile from this GitHub repository -
In your Google Tag Manager Console:
a. Head over to Templates
b. Click New in the Tag Templates section

c. Click the three-dot menu icon in the top right corner of the screen
d. Click Import and upload the .tpl file
e. (Optional) Add a bridge version and userAgentValue in the template's fields. See the configuration fields documented earlier on this page for more information.

- Create a new tag from the template and set the trigger to fire on All Pages. This tag injects the Median JavaScript Bridge into your app so that other tags can use it.
- Publish your GTM container
Build your own tags
You can create additional tags and triggers to call Bridge commands. For example, a tag can check median.auth.status to determine if a user's device supports Face ID or Touch ID. If it's supported, you can trigger biometric login prompts directly from GTM, without writing code into your website.
Updated about 2 hours ago