# google-publisher-tag

Type-safe React wrapper for **Google Publisher Tag (GPT)**.  
Works on any React project (Next.js, Vite, CRA, Remix).

---

## Installation

```sh
npm install google-publisher-tag
# ou
pnpm add google-publisher-tag
```

## Basic usage

```tsx
"use client";

import { GPTProvider, AdSlot } from "google-publisher-tag";

const config = {
  enableSingleRequest: true,
  lazyLoad: true,
};

export default function Page() {
  return (
    <GPTProvider config={config}>
      <h1>My Page</h1>
      <AdSlot
        id="div-gpt-top"
        adUnitPath="/1234567/home_top"
        sizes={[
          [728, 90],
          [320, 100],
        ]}
        targeting={{ pos: "top" }}
        style={{ minHeight: 90 }}
      />
    </GPTProvider>
  );
}
```

## API

<GPTProvider />

config: configurações globais (SRA, lazy load, targeting, etc).

<AdSlot />

Props principais:

id: string → id do container <div>.

adUnitPath: string → caminho do ad unit (/1234567/home_top).

sizes: googletag.GeneralSize → tamanhos suportados.

sizeMapping? → mapeamento responsivo.

targeting? → targeting específico do slot.

Hooks

useGlobalTargeting() → define targeting global.

useRefresh() → faz refresh de todos os slots ou de ids específicos.
