Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

ViscoDesign on "DFP custom targeting for categories"

$
0
0

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 all articles
Browse latest Browse all 8245

Trending Articles