How to stop a session in Google mobile analytics v2 for android without EasyTracker

analytics, android

Solution

In the GA v3, to manually start or end a session, use the tracker's session control parameter as follows:

Start a new session. The next hit from this tracker will be the first in a new session.

[tracker set:kGAISessionControl value:@"start"];

End a session. The next hit from this tracker will be the last in the current session.

[tracker set:kGAISessionControl value:@"end"];

This information is available from the link: https://developers.google.com/analytics/devguides/collection/ios/v3/sessions

Problem

I've read the documentation on the GoogleAnalytics v2 website (I've basically read all the pages from https://developers.google.com/analytics/devguides/) but was not able to find an accurate enough to answer my question. It is either missing or mixed with the version 1 documentation. I know that with EasyTracker, you can set a timeout_session parameter. But I dont want to use EasyTracker and I want to explicitly stop a session at some point in my code. (not setting a timeout) I start a session when I open my application with : ``` mTracker.setStartSession(true); ``` and was wondering if calling ``` mTracker.setStartSession(false); ``` explicitely stops it. Any help or point to a better tutorial/documentation would be greatly appreciated.

Original source