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?