xF2 Template Modifications Enable User-ID tracking in Google Analytics for Xenforo

admin

Max Ping!!!
Thành viên BQT
[AD]
Tham gia
10/12/2020
Bài viết
67
Nơi ở
Hanoi
tác giả
    enable-user-id-tracking-in-google-analytics-for-xenforo-jpg.4

    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
    Mã:
    <xf:if is="$xf.options.googleAnalyticsAnonymize">
                    'anonymize_ip': true,
    </xf:if>
    Add below:
    Mã:
    <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/
     

    Đính kèm

    • Enable User-ID tracking in Google Analytics for Xenforo.jpg
      Enable User-ID tracking in Google Analytics for Xenforo.jpg
      301,7 KB · Lượt xem: 672
    Nếu bạn cảm thấy nội dung chủ đề bổ ích , Hãy LIKE hoặc bình luận để chủ đề được sôi nổi hơn
    Top