Tg-Interstitial: How to integrate the code?

VanillaJS

Follow the instructions below based on your setup type:

React SPA: Insert the code within the <head> tag into public/index.html.
Next.js: Insert the code within the <head> tag into app/layout.js.
Next.js with Pages Router: Insert the code within the <head> tag into pages/_document.tsx.

The code to insert:

<script async src="https://js.onclckmn.com/static/onclicka.js" data-admpid="ADCODE-ID"></script>

for /head

React

Insert the code to index.js or app.js—the main file of the site. This ensures the code loads only once, which is essential.

useEffect(() => {
  const script = document.createElement('script');
  script.src = 'https://js.onclckmn.com/static/onclicka.js';
  script.dataset.admpid = 'ADCODE-ID'; //  AD-CODE-ID
  script.async = true;
  document.head.appendChild(script);
}, []);

Other TMA formats for publishers

Technical writer
James Sullivan
Technical writer
Was this article helpful?