This guide will help SoCast Engage users target ads on their website based on the blog post category. For example, if a user visits a blog for the morning show, you can display ads sponsoring the morning show.
Before you can target ads by blog post category, you need to define the ad slots and set up the ads using the "Ad Setup Code" field on the Advertising page.
Navigate to the Ad Setup Code Field:
Website > Website Settings > Advertising
.Modify the Ad Setup Code:
Below is an example of what the "Ad Setup Code" might look like with the setTargeting
method included. The %socast.blog.categories%
macro dynamically inserts the blog categories for targeting:
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
<script>
window.googletag = window.googletag || {cmd: []};
googletag.cmd.push(function() {
googletag.defineSlot('/1234567/blog_category_targeted_ad', [300, 250], 'div-gpt-ad-123456789-0')
.setTargeting('category', %socast.blog.categories%) // Modify this line to target categories dynamically
.addService(googletag.pubads());
googletag.enableServices();
});
</script>
setTargeting
method is used to dynamically pass the blog categories into the ad targeting.category
) and the %socast.blog.categories%
macro.Next, you need to add the slot you defined in the "Ad Setup Code" to the appropriate ad unit.
Navigate to the Ad Units Module:
Modify the Slot Code:
Below is an example of what the slot code might look like in the "Ad Units" section:
<div id="div-gpt-ad-123456789-0" style="width: 300px; height: 250px;">
<script>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-123456789-0'); });
</script>
</div>
After setting up your ad units in SoCast Engage, you'll need to configure Google Ad Manager to target ads based on the blog categories.
Log in to Google Ad Manager:
Create or Edit a Line Item:
Set Up Custom Targeting:
category
morning-show
, news
, entertainment
).Assign the Line Item to the Ad Unit:
Google Ad Manager Documentation:
SoCast Documentation: