Google DFP:使用javascript将UTM_Source传递给DFP广告管理系统(无需访问DFP广告管理系统管理员) [英] Google DFP: Pass UTM_Source to DFP with javascript (without accessing the DFP Admin)

查看:168
本文介绍了Google DFP:使用javascript将UTM_Source传递给DFP广告管理系统(无需访问DFP广告管理系统管理员)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法来使用javascript从URL获取utm_source值并将其传递给Google DFP,这不涉及在DFP广告管理系统管理员中配置任何内容(例如键值定位)可以访问我们正在使用的特定网站的管理面板。

I'm looking for a way to grab the utm_source value from a URL with javascript and pass it to Google DFP, which doesn't involve configuring anything in the DFP Admin (such as key-value targeting) as we don't have access to the admin panel for the specific site we are working with.

非常感谢任何提示/ javascript代码。

Would appreciate any tips / javascript code.

推荐答案

使用setTargetting。您需要访问DFP广告管理系统信息中心中的广告资源标签,以创建utm代码密钥(键值链接

Use setTargetting. You will need to access the Inventory tab in DFP's dashboard to create the utm code keys (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>

这篇关于Google DFP:使用javascript将UTM_Source传递给DFP广告管理系统(无需访问DFP广告管理系统管理员)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆