Welcome to NulledClub | NulledClub.net

Join us now to get access to all our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, and so, so much more. It's also quick and totally free, so what are you waiting for?
  • Our resources on NULLEDCLUB Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add NULLEDCLUB to trusted sites / sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on NULLEDCLUB"

XF 2.x Enable User-ID tracking in Google Analytics for Xenforo

olalavui

Registered
Registered
Joined
Feb 23, 2021
Messages
2
Reaction score
0
Points
1
Location
Hanoi, Vietnam
Website
buithanhtung.com
Credits
17

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/
 
shape1
shape2
shape3
shape4
shape7
shape8
Top