我正在寻找一种方法,从一个网址与javascript的utm_source值,并将其传递给谷歌DFP,这不涉及配置在DFP管理(如键值目标)的任何东西,因为我们没有访问管理面板,我们正在与特定的网站工作。
感谢任何提示/ javascript代码。
发布于 2017-05-25 02:18:02
使用setTargetting。您将需要访问DFP仪表板中的Inventory选项卡来创建utm代码键(Key-values link)
<script>
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
googletag.cmd.push(function () {
googletag.pubads().setTargeting('utm_source', getParameterByName('utm_source'));
});
</script>
https://stackoverflow.com/questions/43507594
复制相似问题