Hmm....Let me clarify what I am trying to do...
- I'd like to generate a unique identifier that can be associated with each pageview in Google Analytics including the visitors initial landing page.
- This unique ID would be passed along during GA async page tracking as a custom variable.
- Every pageview from that visitor in GA reporting would then be tagged with this custom var containing the unique id.
Most of our visitors are anonymous, and are not logging into modx at all.
The GA tracking code fires in the html head, so the tricky part is that the unique ID would have to be available prior to processing the head of the visitors landing page.
I had envisioned using a Session Var to store this unique ID and retrieve it in the GA code, but that would of course require that a Session is established in time to store the var and retrieve it on the very first page load.
It doesn't have to be the actual session ID, it just has to be unique.
I am already running a mutliple context gateway plugin on the site that detects the hostname and redirects to the appropriate site context's home page. It seemed like this would be the place to generate the id, but I am not clear on when the sessions are actually established in modx with the default db session management.
Thanks,