I need to tracking some User data for each post tag. For this, I'm using Google Analytics and Google Tag Manager. The dataLayer looks like:
{
"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.
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.
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. That way you can just loop through that variable and access each element of that array.
您可以使用GTM中的dataLayer变量获取整个pageAttributes数组,然后使用数组长度获取单个标签。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.