Skip to content

Install on any HTML site

This works on any site where you can edit the HTML: hand-written pages, static site generators, Webflow, Squarespace, Wix, Shopify themes and server templates. The portal shows your exact code under Ad Units & Tags → Install site tag.

Paste the site tag into the <head> of every page: your theme or layout template, so it is on each page exactly once.

<!-- TerraGaming Media site tag: Your Site. Add it once, in the <head> of every page. -->
<script async src="https://tgmads.example.com/tag.js"></script>
  • tgmads.example.com is your own host, the CNAME you verified in Integration Setup. The tag loads your property’s settings from it, so there is nothing else to configure.
  • Until your CNAME is verified, the tag loads from the shared host and carries your ids:
<script
async
src="https://cdn.terramedia-sandbox.com/tag.js"
data-tgm-property="PROP-…"
data-tgm-publisher="PUB-…"
data-tgm-in-article="TGM-…-INART"
data-tgm-article-selector=".post-content"
></script>

One site tag serves every ad unit on the page. Never add it again for a new unit, and never copy tag.js into your own site: it must load from the host above.

Put a placement wherever an ad should appear. Use the ad unit ids from the portal:

<!-- TerraGaming Media ad: Homepage Right Sidebar -->
<div data-tgm-unit="TGM-ABC-HRS01"></div>
  • The same unit can appear on many pages, and more than once on a page.
  • The floating banner unit anchors to the bottom of the screen wherever its div sits. Place it once, for example at the end of your layout.
  • In-article ads need no markup. The tag inserts them after the 3rd paragraph of the element matching your article selector (.post-content unless you change it in the portal), at most three per page.
  • An empty slot collapses (data-tgm-state="unfilled"), so your layout never shows a blank box.

Open a page, then in the browser console run:

window.tgm.status();

It shows your propertyId, state: "running" and every placement under slots. Within about 10 minutes the portal shows Tag detected for the property. Ads only appear once the visitor has consented to advertising (see Content Security Policy and consent).

Sites installed before October 2026 have an inline window.tgmConfig = {…} block and a tgmQ.push(…) script per unit. They keep working. To pick up portal changes such as a new article selector automatically, replace them with the site tag and placements above.