[英]Tracking Wordpress Post Tags in Analytics using Google Tag Manager
I need to tracking some User data for each post tag. 我需要为每个帖子标记跟踪一些用户数据。 For this, I'm using Google Analytics and Google Tag Manager. 为此,我使用了Google Analytics(分析)和Google Tag Manager。 The dataLayer looks like: dataLayer看起来像:
{
"pagePostType":"post",
"pagePostType2":"single-post",
"pageCategory":["ha-kidd-knitting-supplies"],
"pageAttributes":["big-time-yarn","charles-voth","classic-shades","easy-knits","km066","knitted-cowl","textured-cowl","universal-yarn"],
"pagePostAuthor":"Charles Voth"
}
The pageAttributes
key contains the tags. pageAttributes
键包含标签。
How can I track all these tags without use dot notation? 如何在不使用点符号的情况下跟踪所有这些标签? The posts could have 1, 2, 3, 4... or more tags, so I can't use dot notation. 帖子可以包含1、2、3、4 ...或更多标签,因此我不能使用点符号。
I mentioned here in this answer Tracking WP Post Tags using Google Analytics and dataLayer (GTM) that for the pageAttributes
, you should assign that as the value for a Data Layer type variable. 我在此答案中提到了使用Google Analytics(分析)和dataLayer(GTM)跟踪WP Post标签的情况 ,对于pageAttributes
,应将其分配为数据层类型变量的值。 That way you can just loop through that variable and access each element of that array. 这样,您就可以遍历该变量并访问该数组的每个元素。
您可以使用GTM中的dataLayer变量获取整个pageAttributes数组,然后使用数组长度获取单个标签。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.