Whenever you want to create a contextual ad on your website, you can use a ready-made tag in Tag Manager, called a custom content. We designed it to help you better manage and display this type of ad.
A contextual ad can be anything from a banner to an info-box. Unlike pop-ups, it appears inside the content of your website. For example, it can be an info-box about the new podcast at the end of your blog post. In this article, we’ll show you how to set it up.

Before you start
Here are some things to know before you begin working with custom content tags:
- You need to have basic knowledge of HTML and CSS to design the contextual ad (the content), but setting it up is easy.
- The custom content tag is set to be displayed for visitors who consent to A/B testing and Personalization, but you can change this setting.
- A custom content tag loads simultaneously with other tags (It’s an asynchronous tag).
- You need to tell where the content will be displayed. For that, you need to have a target ID (a div ID) on your website.
Set up a custom content tag
To set up a custom content tag, follow these steps:
- Design and code your contextual ad in HTML.
- Go to Menu > Tag Manager.
- Navigate to Tags.
- Click Add a tag.
- Name the tag and choose the following tag type: Custom content.
- In HTML tag code, type the code with your contextual ad.
- In Content placement, type the target element ID from your website. For example, a div ID of the section where you want to display the contextual ad.
- In Advanced tag settings, set the tag type. By default, it’s set to be displayed to visitors who consent to A/B Testing and Personalization, but you can change it to a different type.
- Respect opt-out and DNT is turned on by default. Leave it as is, if you want to respect visitors who set Do-Not-Track in their browsers, or visitors who opt out of tracking using our opt-out form.
- Enable document.write is turned off by default. Toggle this option, if your tag needs
document.write
. - In Flight dates, set the date and time when the tag is fired.
- In Tag triggers, click Add a trigger or Choose existing trigger to set up a trigger for your contextual ad.
- If you’re setting up a new trigger, name the trigger.
- In Trigger type, choose the trigger type. For example, Page view.
- Click Next.
- In Trigger conditions, define conditions for the trigger. For example,
Page URL contains blog
.
Available below 16.0.0
In Audiences, pick an audience for which you want to display the contextual ad. For example, we’ve got an audienceApple product users
and we want to display the content only for visitors from this audience.
Tip: For more about audiences, read this article.
- In Multiplicity, set how often the tag should be fired. For example, Many times during a session.
Tip: We advise you to fire the custom content tag multiple times. Otherwise, your contextual ad may appear and disappear after a visitor reloads the page.
- When you’re done, click OK.
- Click Save for the tag.
- Test your tag in debug mode.
- When you’re happy with how the tag works, click Publish.
Track content impressions
To start tracking content impressions, follow these steps:
- Go to Menu > Tag Manager.
- Navigate to Tags.
- On the left, click Piwik PRO (tracking code).
- In Data collection, turn on Interactions with popups and content.
- After this option is turned on, the tracker will start counting content impressions on your website. All stats will be available under Menu > Analytics > Reports > Content performance.