DFP custom targeting for categories
-
Hi, I’m trying to get the category (on an archive page) to pass it into the DFP ad tag, but the code I have is not working:
<script type='text/javascript'> <?php $category = get_the_category(); echo 'googletag.pubads().setTargeting("category", "'.$category[0]->slug.'");'; ?> googletag.cmd.push(function() { googletag.display('div-xxxxxx'); }); </script>
The code seems to run ok, but the category ‘value’ is not being passed through. It’s always blank.
Any thoughts?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘DFP custom targeting for categories’ is closed to new replies.