A step by step guide to integrating Ad Management on your websites. Client side tech integration
A) Prepare your website
- Remove your current display monetization/library (GAM, TAM, Prebid library,..)
- Remove your current Pubstack Analytics tag (
v1/tag
for analytics VSv1/adm
for Ad Management) - Make sure divs for your Ad Containers are on the page and the div ids match what is defined for your adUnits in Pubstack (⚠️ no random div IDs ⚠️)
B) Adding Pubstack Ad Management to your page
Retrieve your SITE-ID
and use it to add the Pubstack Ad Management’s script in the head
of your page.
This can be retrieved directly from Pubstack UI via this link :
<script async src="<https://boot.pbstck.com/v1/adm/[SITE-ID]>"></script>
C) Adding context to your page with <meta>
Context are used :
- To build GAM AdUnitPath
- To define context of a page (eg : subscribers)
⚠️ ⚠️ : Context keys (name + values) need to be pre-defined within Pubstack UI ⚠️ ⚠️
-
To build your GAM adUnitPath
On any given page, meta tags are necessary to build your GAM adUnitPath.
Inject 1 meta tag for each level of the GAM path, except the first level (Network ID) and the adUnit level.
For instance, the metas required for the homepage with adUnitPath = /XXXXXX/website/desktop/homepage/AdUnit could look like :
<head>
<meta name="pbstck_context:site_name" content="website"/>
<meta name="pbstck_context:device" content="desktop"/>
<meta name="pbstck_context:section" content="homepage"/>
...
</head>
/*
Will allow us to build adUnitPath = /XXXXXX/website/desktop/homepage/AdUnit
site_name = GAM level_1
device = GAM level_2
section = GAM level_3
*/ -
To define context to your pages (eg : subscribers).
This can be used to load a dedicated stack on some pages or users. For instance for subscribers.
If you want to set context ctx1
with value value1
or the context subscribers=True
:
<meta name="pbstck_context:ctx1" content="value1"/>
<meta name="pbstck_context:subscribers" content="True"/>
If empty value, the key can be completely removed
Any context will also be sent to GAM as key value.
D) Send key-values to GAM
This custom key values will be sent to GAM. It does NOT need to be predefined in Pubstack UI.
To set global GAM targeting at page level, add meta tags in your html page’s header tag:
- Each tag should contain two attributes:
- name = key name prefixed by “ad:”
- content = contains one or several values separated by commas
The required syntax is as follows:
<head>
<meta name="ad:my_key" content="first_value, second_value" />
<meta name="ad:my_key2" content="my value with spaces" />
</head>
Eg : This will target the GAM Key “audience” with Value “logged_user”.
<head>
<meta name="ad:audience" content="logged_user" />
</head>
Those have to fit GAM rules :
Valid key names
- Are not case-sensitive
- Cannot start with a number
- Cannot contain spaces
Valid value names
- Are not case-sensitive
- Can start with a number, contain only numbers, or be a combination of numbers and letters
- Can contain spaces
see https://support.google.com/admanager/answer/10020177?hl=en&ref_topic=10019298 :