Can Glean.js read the GA client id?
Categories
(Data Platform and Tools :: Glean: SDK, task)
Tracking
(Not tracked)
People
(Reporter: Dexter, Unassigned)
Details
GA is tightly coupled with the rest of the Google ecosystem. Some other services require the GA client id to work. Is such id available for reading to Glean? Can we technically report that?
Bruno, can you double check this?
| Reporter | ||
Comment 1•1 year ago
|
||
And the gclid (google click id)
Comment 2•1 year ago
|
||
It looks like we can fetch the GA client ID via cookies if one exists. I used the second method described on this site.
I copied and pasted this minified JS into the browser console for Monitor and it reported my GA client ID.
document.getGaClientId = function get_ga_clientid(){var i={};return document.cookie.split(";").forEach(function(t){var n=t.split("="),r=n[0].trim(),a=n[1];i[r]=a}),i._ga.substring(6)}
document.getGaClientId();
And the gclid (google click id)
This one doesn't seem to have as straight forward of an answer. From my understanding, it looks like maybe we can just look in the current URL itself whenever Glean is initialized and determine if we have a gclid? Then if we do have something, we can just automatically record and report it in the next event. I found a few articles that tell you how to record the click itself from gtag manager and the scripts that you drop in, but nothing specific about trying to extract it.
Is that roughly what you were asking?
| Reporter | ||
Comment 3•1 year ago
|
||
Thanks Bruno, this is exactly what I was looking for!
Description
•