html BlueKai Google Analytics集成代码(gtag.js)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html BlueKai Google Analytics集成代码(gtag.js)相关的知识,希望对你有一定的参考价值。

<!-- run this on your page BEFORE the BlueKai Code -->

<!-- Ensure you have created a 'user' level custom dimension in GA to receive this -->

<!-- Global Site Tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXX-X"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

// Maps 'dimensionX' to 'bluekai_id'. (Replace x with your dimension number)
gtag('config', 'UA-XXXXXX-X', {
  'custom_map': {
  	'dimensionX': 'bluekai_id' // (Replace x with your dimension number)
  }
});

__bluekai_data_sent = false;

function receiveMessage(event) {

	if (event.origin === 'http://tags.bluekai.com' || event.origin === 'https://tags.bluekai.com') {

		if (__bluekai_data_sent === false && typeof event.data !== 'undefined' && event.data.source === 'bluekai') {

			// Declare BlueKai ID as custom dimension X
			gtag('event', 'bluekai_id_dimension', {'bluekai_id': event.data.bluekaiId});			

			__bluekai_data_sent = true;

		}

	}

}

addEventListener('message', receiveMessage, false);

</script>
<!-- Create this as a tag in BK and schedule this in your container(s)-->
<script type="text/javascript">
var bkuuid= '$_BK_UUID';
parent.postMessage({ bluekaiId: bkuuid, source: 'bluekai' }, '*');
</script>

以上是关于html BlueKai Google Analytics集成代码(gtag.js)的主要内容,如果未能解决你的问题,请参考以下文章

html poste.it:BlueKai标签

html 下一页:自定义BlueKai代码

html BlueKai:标签管理:Phint Grabber

html 基础媒体:BlueKai像素生成器

html BlueKai:CoreTag代码模板

html 校长海莉:BlueKai标签模板