Reputation: 211
So I'm working on implementing the latest Google Tag Manager into my application for use with Google Analytics. It's in place and everything is working great, but I do have a question.
Is it possible to manually start a new session within GA while using GTM to fire all of the events? For example, when I user logs out I would like to begin a new session, can I force that to happen using GTM?
Thanks!
OSFTW
Upvotes: 2
Views: 930
Reputation: 32537
You can do this with the sessionControl
config var.
In GTM, in your GA tag config, it's under
More Settings >
Fields to Set
Click the Add Field button, then for Field Name put sessionStart
and for Value put "end" to force end of the current session or "start" to force (re)start of session.
Notes:
If you are using a Web
Container Type, this is only available for Universal Analytics
Tag Type. The Classic Google Analytics
Tag Type does not have an equivalent, though you can maybe do some magic with _setSessionCookieTimeout if you're feeling ambitious.
If the GTM container is created as Mobile
Container Type, it will only show Google Analytics
as a Tag Type option, but this is a misnomer. Under the hood, GTM uses the Measurement Protocol for Mobile
containers, and sessionControl
is available for that.
Upvotes: 2