Analytics, ads or both
The two tags, choosing modules with data-modules, and moving from the single tag.
Pubber is one SDK made of modules: a small core, the analytics module (Pubber Analytics) and the ads module (Pubber Ads). It comes as two tags. Which one you install sets the most your site can run; your site's settings, which you change in the portal, decide what actually runs.
The two tags
Analytics and ads: the full tag
<script async src="https://pubber.io/v1/sdk.js" data-site="YOUR_SITE_KEY"></script>The core with both modules. Install it if your site runs Pubber Ads, with or without analytics. It runs only what the site is set up for: a site that hasn't been approved for ads runs analytics alone, and shows no offers, until it is. So offers are never slowed down, the full tag asks for them as soon as the page is ready, alongside the site's settings, and places them only once the settings say the site runs ads; Pubber answers a site without ads with nothing.
Analytics only
<script async src="https://pubber.io/v1/pubber-analytics.js" data-site="YOUR_SITE_KEY"></script>The core with the analytics module, about 5 KB gzipped. It can't show offers, whatever the site's settings say: to add Pubber Ads to a site that uses it, replace it with the full tag. Your portal shows the right one for each site's products.
Use one tag per page. If both are on a page, the first to load runs and the other does nothing.
What decides what runs
- Your site's products. In your portal, each site has Pubber Analytics and Pubber Ads, each on or off. Ads also need the site approved; until then the site runs analytics alone.
- The tag. The analytics tag can only run analytics.
data-modules, if you add it. It narrows what the tag runs on a page; it can never turn on a product the site doesn't have.
The tag asks Pubber for the site's settings each time a page loads (the answer is cached by the browser for a few minutes), so a change in your portal reaches readers without touching your code.
Choosing modules on a page: data-modules
Add data-modules to the tag with the modules it may run, separated by spaces or commas. For example, to measure a section of your site without ads on it:
<script async src="https://pubber.io/v1/sdk.js" data-site="YOUR_SITE_KEY" data-modules="analytics"></script>data-modules="analytics": analytics only, even where the site runs ads.data-modules="ads": ads only; the page isn't counted in your analytics.data-modules="analytics ads", or no attribute: everything the site runs.
To keep ads off particular pages of a site that runs them, you can also exclude paths in your site's settings; see Controlling ads.
Moving from the single tag
No action needed. Every site that installed Pubber before analytics and ads were separate keeps its tag, /v1/sdk.js, which is now the full tag. Those sites run both products, exactly as before, with the same cookie. You don't need to change your code, and the tag's address won't change.
If you'd like analytics alone on such a site, turn Pubber Ads off for it in your portal; the full tag then stops asking for offers. Switching to the smaller analytics tag is optional.
Seeing what runs
Add data-debug="1" to the tag and open the browser console: it logs the modules that started and whether the site is cookieless. From your own code, window.pubber.ready() tells you the same; see the JavaScript API.