XF 2.0 How not to embed Google Analytics in conversation pages?

#1
I don't think conversations need to be sniffed by Google Analytics, so is there a way to exclude Google Analytics from conversation pages?

Maybe wrapping
HTML:
<xen:if is="{$isConversation}">
around the analytics template works, but what would the isConversation variable be?
 
Last edited:
#2
It's kind of a security concern that private conversation pages have Google Analytics loaded, maybe exclude it by default for xenforo?
 

Mr Lucky

Well-known member
#4
The conversation pages are only viewable by the members in the conversation, so (theoretically!) Google bots cannot go to those anyway. There are no public links to anyone's conversations.
 
#5
No, that is not good enough, analytics.js is loaded into the web page, Google grabs the html content through analytics javascript without respecting the robots.txt because it's not Google bot crawling, permission is given the moment we signed up for analytics.

It's not just the title leaking, as long as there're foreign scripts loaded to the conversation page, there is a security concern.

All that's needed is the isConversation variable to not insert analytics tracking code when conversation page is loaded.
 

Optic

Well-known member
#8
around the analytics template works, but what would the isConversation variable be?
Hi, try targeting the page template, there are a number of them in Conversations:
PHP:
<xf:if is="$template !== 'conversation_view' AND $template !== 'conversation_list' AND $template !== 'conversation_add'">
Analytics code
</xf:if>
 
Top