Hi!
I work a lot with Google Tag Manager. I am programming a serie of tags to track user behaviour (time to read a post, type of user taking into consideration the previous metric and the number of words of a post (scanner, reader, intensiv reader…), identify users that comment, that share content in social networks…)
I would like to fire these tags only in posts (not in pages or other elements). I could use the URL as a firing rule, but I should update those rules every time I add new categories. As you know the whole code better than me, maybe you can help me saying of the following approach should be ok:
If those arguments are true, then I can use the class of the body element to identify posts and send the Google Tag Manager Tags (document.getElementById(“top”).className;)
Thank you!!
Agustín
Hi Agustin!
Yes, that would work, Posts also receive the ID in a class like postid-xx in case you wanted to target a specific Post.
Regards,
Josue
Thanks Josue! Is this postid-xx class a special Enfold’s Feature or it is part of WordPress vanilla code?
Best Regards,
Agustin
Hey!
Its part of the WordPress body class function: http://codex.wordpress.org/Function_Reference/body_class
Best regards,
Devin