Enable User-ID for Xenforo

olalavui

New Member
Registerd
Joined
Jan 8, 2021
Messages
27
Reaction score
1
Points
1

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
  1. https://support.google.com/analytics/answer/3123666?hl=en
  2. https://developers.google.com/analytics/devguides/collection/gtagjs/cookies-user-id
  3. https://xenforo.com/community/resources/conditional-statements-for-xenforo-2.5795/
 

Create an account or login to download resources

You must be a member in order to download resources and enjoy exclusive benefit in our community

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Top