[英]Google DFP: Pass UTM_Source to DFP with javascript (without accessing the DFP Admin)
我正在尋找一種使用javascript從URL中獲取utm_source值並將其傳遞給Google DFP的方法,該方法不涉及在DFP管理員中配置任何內容(例如鍵值定位),因為我們無權訪問轉到我們正在使用的特定站點的管理面板。
將不勝感激任何提示/ JavaScript代碼。
使用setTargetting。 您將需要訪問DFP廣告管理系統儀表板中的“廣告資源”標簽,以創建utm代碼鍵( 鍵值鏈接 )
<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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.