- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
06-22-2016 09:38 AM
Dear Community,
we collect the _ga User ID from the _ga cookie and place it into a custom dimension through a "Set Value" extension which is mapped to the tag.
Unfortunately this value becomes available when the _ga cookie is generated which happens when the GUA tag fires and therefore the custom dimension is not populated on the first interaction with the website.
Are you aware of any solution to fix this?
Thank you very much in advance for your help.
KR,
Mattia
06-28-2016 03:01 AM
Anyone can help on this one?
Please :)
Thank you very much.
06-28-2016 03:54 AM
My guess is, your best bet is a JS extension scoped to "end" that reads the cookie. And then fires an event to GUA.
Something like this:
Adrian
06-28-2016 05:01 AM
Thank you very much @adrian_browning
How would the code look like if we want to apply this only to the first page on the first session? Because that is where we miss the value with our current implementation.
After that the cookie will be already set in the browser and and the cd will get populated with the GUA tag.
thanks again for your help.
06-28-2016 05:27 AM
@defelicemattia So you would want to wrap it like this:
if (!utag.data["cp._ga"]) { var _ga_id = document.cookie.match(new RegExp('_ga=([^;]+)')); ga('send', 'pageview', { 'dimensionXX': _ga_id }); }
This would stop it firing if that cookie is present.
Adrian
Copyright All Rights Reserved © 2008-2023