Manage session
In case the user and session management is done by your backend, Copilot.cx SDK and Copilot.cx cloud should be aware regarding user's active session information. This component functionality is reachable by accessing Copilot.instance.manage.yourOwn
.
Session started
Notify to Copilot.cx start tracking user's session when an authenticated session is obtained by your user management solution (e.g. user just performed signup or login in your application). The sessionStarted()
method accepts the following parameters:
userId
- (String) - The unique user identification used in your user management solution. This value should be exact same value that will be passed to the Collect API once triggered from your backend for this specific user.isCopilotAnalysisConsentApproved
- (Boolean) Property indicating whether the user accepted analytics tracking. In case the application does not require GDPR compliance, set this parameter as constanttrue
.
The session data you provide is persistent on the mobile device. Meaning, after setting user's session data once, and the user re-starts the application, the values above will be used to track user's session until
sessionEnded()
or alternativesessionStarted()
method will be invoked.
Copilot.instance
.manage
.yourOwn
.sessionStarted(with: USER_ID_HERE,
isCopilotAnalysisConsentApproved: USER_CONSENT_VALUE_HERE)
Copilot.getInstance()
.Manage
.YourOwn
.sessionStarted(USER_ID_HERE,
USER_CONSENT_VALUE_HERE);
Copilot.getInstance()
.Manage
.YourOwn
.sessionStarted(USER_ID_HERE,
USER_CONSENT_VALUE_HERE);
Session ended
Notify to Copilot.cx end tracking of user's session when user performs logout in your application. Session data will be removed and any consecutive analytics event won't be bound to specific user's session.
Copilot.instance
.manage
.yourOwn
.sessionEnded()
Copilot.getInstance()
.Manage
.YourOwn
.sessionEnded();
Copilot.getInstance()
.Manage
.YourOwn
.sessionEnded()
Update user's consent
Notify to Copilot.cx to modify user's analytics tracking consent as which was set in when calling previously to the sessionStarted()
method. The setCopilotAnalysisConsent()
method accepts the following parameter:
isCopilotAnalysisConsentApproved
- (Boolean) Property indicating whether the user accepted analytics tracking. In case the application does not require GDPR compliance, set this parameter as constant true.
Copilot.instance
.manage
.yourOwn
.setCopilotAnalysisConsent(isConsentApproved: USER_CONSENT_VALUE_HERE)
Copilot.getInstance()
.Manage
.YourOwn
.setCopilotAnalysisConsent(USER_CONSENT_VALUE_HERE);
Copilot.getInstance()
.Manage
.YourOwn
.setCopilotAnalysisConsent(USER_CONSENT_VALUE_HERE)