Analytics
3.7K members online now
3.7K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

User ID and cached pages

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi, I did a standard implementation of the User ID - sending it with the All Pages - Universal Analytics - Page view tag. The problem is that many of the pages - e.g. product pages on our e-commerce website are fully cached and will not have the right User ID before the page is properly loaded. I don't think it is a good idea to have seperate pageview tags depending on page type and am trying to figure another work around. Does anyone have a better solution?

1 Expert replyverified_user

Re: User ID and cached pages

Rising Star
# 2
Rising Star
Hi Anna,

It sounds like maybe you are using GTM. If so, have you experimented with setting an event in the dataLayer when the userid is set and available? That way you could set your pageview tags to fire based upon the new set value. Obviously you would want to allow for timeout etc so that the event populates if the retrieval of the user id fails.

Hope that helps.

Best,

Theo Bennett
Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn

Re: User ID and cached pages

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hi Theo,

Yes, I am using GTM. In the data layer I have an event called "visitorDataReady" but I'm thinking the event will always be fired, even in the cacached pages - the user data may, however, be wrong.

Best,
Anna

Re: User ID and cached pages

Rising Star
# 4
Rising Star
Hi Anna,

So to restate the problem:
"... many of the pages - e.g. product pages on our e-commerce website are fully cached and will not have the right User ID before the page is properly loaded."

This would be local on the client side, right? So the possible problem would be multiple users on one log-in?

Sorry, I might be missing the problem but if that's all, I'm not sure you have that big of an issue. Smiley Sad

I hope that helps in some way!

Theo Bennett

Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn

Re: User ID and cached pages

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
Hi,

Unfortunately, it can be any random user id - it is not just local. What we've done for now is set the pageview for cached pages tag to fire only after the window is loaded.