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

wen2018

New member
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:
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.
 
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.
 
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 Bottom