0

I would like to segment logged in and not-logged-in users using GA. The idea I have in mind is to create a Data Layer Variable (logged_in), and then ask my developers to push a value for that variable into the Data Layer on every page (either ‘yes’ or ‘no’). So the code would look something like:

var loggedIn = checkIfLoggedIn(); //returns ‘yes’ if logged in
dataLayer.push ({ ‘logged_in’ : loggedIn})

Now I assume there will be some server-side scripting involved using PHP and that this cannot be accomplished using pure Javascript. I am not aware of the details, but I guess my developers will be able to take care of it. As a not-so-technical marketer, all I need to tell them is to push so-and-so data into the dataLayer, right?

Next, I’ll create a GTM Google Analytics Custom Dimension tag that is fired on every Pageview event, and update a Custom Dimension on the logged-in status.

Will this approach work? Please let me know, thanks!

0

Yes, that's how it should happen. You tell the devs to populate, from the backbend, if a user is logged in or not, and then you populate your custom dimension with that value for every page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.