javascript - DFP and Wordpress integration (no plugins) -


trying make better use of dfp along wordpress. has being difficult work.

this problem, have big wordpress website lot of categories , tags, wanted stop using plugins , php change gtm .

so first approach was:

loop dfp tag javascript

and reading targeting in dfp, may way need use :

to prevent use of:

  if(is_category('1') && has_cateogry('1')){        <div id="div-dfp-ad-top-<?php mycategory(); ?>"></div>      } else if (is_tag('1000')) {        <div id="div-dfp-ad-top-<?php mytag(); ?>"></div>      } else {        <div id="div-dfp-ad-top-default"></div>      }

we don't want touch wordpress template code, need add placements:

<div class="div-dfp-top-a"></div>

<div class="div-dfp-top-b"></div>

<div class="div-dfp-box-a"></div>

instead use like:

https://sitesforprofit.com/target-dfp-to-urls

but changes :

var dl_category = document.queryselector("meta[property='article:section']").getattribute("content");    googletag.pubads().settargeting("category",dl_category);

in theory, stop changing wp code , using dfp , gtm.

what think?

i test , in meantime want know opinion.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -