goopubtag-gustavolbs
v0.4.7
Published
React library for Google Publisher tag
Maintainers
Readme
Goopubtag
Goopubtag is a modern solution for Google Publisher tag in React applications. It was heavily inspired by the widely used react-dfp package, and aims to provide a similar DX but with some improvements:
- Functional approach (with hooks) 🪝
- Type safety with typescript 🎉
- Ease of use with debug mode 🛠️
- Support for most recent GPT implementations 🚀
To get started, head over to the documentation site.
Installation
At the route of your application, in your terminal run:
npm install goopubtag-gustavolbs # or yarn, pnpmUsage
After installation is complete, you can start using goopubtag in your application:
import { GPTProvider, GPTSlot } from 'goopubtag-gustavolbs';
const Component = () => {
return (
<div>
<GPTProvider networkId={123456}>
{/** .. */}
<GPTSlot slotId="your-slot-id">
</GPTProvider>
</div>
);
}If you're using Next.js, don't forget to add this:
<head>
...
<Script
strategy="afterInteractive"
src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"
/>
...
</head>