Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert GTAG Parameters into Server-Side Parameters too #5

Closed
aawnu opened this issue Jul 15, 2022 · 2 comments
Closed

Convert GTAG Parameters into Server-Side Parameters too #5

aawnu opened this issue Jul 15, 2022 · 2 comments
Assignees
Labels
wontfix This will not be worked on

Comments

@aawnu
Copy link
Owner

aawnu commented Jul 15, 2022

Studying the PageView request made by GTAG in JavaScript it seems that parameter names are the same as V1 but with limited parameter scope.

https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters

GET Parameters

v: 2
tid: G-XXXXX
gtm: 2oe7d0
_p: 1486226803
_z: ccd.v9B
cid: 00000.000000
ul: en-us
sr: 1920x1080
sid: 1657899578
sct: 3
seg: 1
dl: http%3A%2F%2F127.0.0.1%2F
dr: http%3A%2F%2F127.0.0.1%2F
dt: Chttr.link
_s: 1

Body Parameters

en=page_view&_ee=1
en=scroll&epn.percent_scrolled=90&_et=8
@aawnu aawnu added the enhancement New feature or request label Jul 15, 2022
@aawnu aawnu added this to the Release v1.0.0 milestone Jul 15, 2022
@aawnu aawnu self-assigned this Jul 15, 2022
@aawnu
Copy link
Owner Author

aawnu commented Jul 15, 2022

With a little help from a cheatsheet website the parameters have somewhat been "decoded" now.

/**
 * Using V1 parameters to imulate a page view through server side \
 * Be aware that this requires custom client_id and may result in loss of demographic information
 * @link https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters
 * @link https://www.thyngster.com/ga4-measurement-protocol-cheatsheet/
 * @param string    v       Protocol Version eg "2"
 * @param string    tid     Tracking ID eg "G-xxx"
 * @param bool      aip     Anonymize IP eg "true"
 * @param string    gtm     GTM Hash Info
 * @param string    _p      Random load hash // Math.floor(Math.random() * (2147483647 - 0 + 1) + 0)
 * @param string    _z
 * @param string    cid     Client ID eg Cookie._ga or Cookie._gid or Session ID
 * @param string    uid     User ID eg "customer_1"
 * @param string    ul      User Language eg "en-us"
 * @param string    sr      Screen resolution eg "1920x1080"
 * @param string    sid     Session ID 
 * @param string    sct     Session Count // Incresed by 1 per session registered (expired)
 * @param string    seg     Session Engagement eg "1"
 * @param string    dl      Document Location eg http://foo.com/home?a=b as http%3A%2F%2Ffoo.com%2Fhome%3Fa%3Db
 * @param string    dr      Document Referer eg http://example.com as http%3A%2F%2Fexample.com
 * @param string    dt      Document Title eg <title>THIS</title>
 * @param int       _s      Hit Counter eg "1"
 */

@aawnu
Copy link
Owner Author

aawnu commented Jul 16, 2022

I'm closing this as Won't Fix due to tags that are generated with GTM/GTAG that can not be properly replicated in PHP to my knowledge as is right now.

It might come back up at a later time.

@aawnu aawnu closed this as not planned Won't fix, can't repro, duplicate, stale Jul 16, 2022
@aawnu aawnu added the wontfix This will not be worked on label Jul 16, 2022
Repository owner locked as off-topic and limited conversation to collaborators Aug 30, 2022
@aawnu aawnu removed the enhancement New feature or request label Aug 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant