xF2 Template Modification ENABLE USER-ID TRACKING IN GOOGLE ANALYTICS FOR XENFORO

olalavui

Member
Registered
Joined
Nov 30, 2020
Messages
8
Points
13

Reputation:

This tutorial will help you enable tracking User-ID features in Google Analytics (default in Xenforo only tracking pageview & auto event by Google)

Step 1: Follow guide on https://support.google.com/analytics/answer/3123666?hl=en to create new User-ID View on GA.
Step 2: Login your Xenforo Admin -> Appearance -> Templates -> find template name: google_analytics
Find
Code:
<xf:if is="$xf.options.googleAnalyticsAnonymize">
                'anonymize_ip': true,
</xf:if>

Add below:

Code:
<xf:if is="{$xf.visitor.user_id}">
                'user_id' : '{$xf.visitor.username}',
</xf:if>

Done tutorial, you can check result via view-source.

Reference
 
Top