html Facebook Custom Audience Pixel:BlueKai Tag Manager

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html Facebook Custom Audience Pixel:BlueKai Tag Manager相关的知识,希望对你有一定的参考价值。

<script type="text/javascript">
// Facebook Custom Audience Pixel
(function(){

	// Set up (do not change)
	var custom_params = [];

	// Config (change)
	var pixel_id = 12345678; // change to your pixel ID
	var event_name = "BlueKai Tracking"; // change to your event name
	var grab_all_phints = true; // Set to false if you don't want to send all phints to Facebook

	// Custom Parameters : specify any additional custom parameters you would like
	custom_params.push(["PARAM NAME","PARAM VALUE"]); // e.g. for single values ["content_name","article"]	
	custom_params.push(["PARAM NAME",["PARAM VALUE 1","PARAM VALUE 2"]]); // e.g. for multiple values ["keywords",["watches","shoes"]]	


	// ### DO NOT EDIT BELOW THIS LINE ###

	var ts = Math.round((new Date()).getTime() / 1000);
	var cacheBust = parseInt(Math.random()*10000000000);
	var fb_url = "//www.facebook.com/tr/?id=" + pixel_id + "&ev=" + encodeURIComponent(event_name) + "&ts=" + ts + "&dl=" + encodeURIComponent(document.referrer) + "&cb=" + cacheBust + "&";

	if (grab_all_phints){
	
		var phints = {};
		var url_args = document.location.search.split("&");

		for (var i = 0; i < url_args.length; i++) {
			
			if(url_args[i].indexOf("phint=") === 0){

				var phint_name = url_args[i].split("phint=")[1].split("%3D")[0];

				var phint_value = decodeURIComponent(url_args[i].split("phint=")[1].split("%3D")[1]);

				if (phints[phint_name]){
					phints[phint_name].push(phint_value)

				} else {

					phints[phint_name] = [phint_value]
				}
			}
		}
	
		for (phint_name in phints){

			if(phints[phint_name].length === 1){

				custom_params.push([phint_name,phints[phint_name][0]]);

			} else {

				custom_params.push([phint_name,phints[phint_name]]);

			}

		}

	}

	var fbCustomParams = [];	
	
	for (var i = 0; i < custom_params.length; i++) {


		// var name
		var key_value_pair = "cd[" + encodeURIComponent(custom_params[i][0]) + "]=";

		if(typeof custom_params[i][1] === "object" && custom_params[i][1].length > 1){
	
			key_value_pair += encodeURIComponent("[" + custom_params[i][1].join(",") + "]");
		

		} else {

			key_value_pair += encodeURIComponent(custom_params[i][1]);
		}
		

		fbCustomParams.push(key_value_pair);
	}


	fb_url += fbCustomParams.join("&");
	
	var fbPixel = new Image();
	fbPixel.height = '1';
	fbPixel.width = '1';
	fbPixel.src = fb_url;

})();
</script>

以上是关于html Facebook Custom Audience Pixel:BlueKai Tag Manager的主要内容,如果未能解决你的问题,请参考以下文章

Audi ATOM 컨셉트카~

「第25小时计画」?零塞车计画?Audi做出未来城市的概念

python学习2

PythonCrashCourse 第五章习题

html [ArasLabs / custom-form-css]显示custom_icon表单字段的内容

html custom_event_page.html