LogoLogo
HomeDashboardProduct Docs
  • Introduction
  • Core Concepts
    • Events
    • Sessions
    • User/Customer Profile
  • PLATFORM INTEGRATIONS
    • Shopify Integration
  • Sdk Integrations
    • Browser SDK
      • Integrate SDK
      • Track Events
      • Track Users
      • Configure Web Push
      • Reading Session Identifer
      • Syncing Cart Items
    • Android SDK (Coming Soon)
      • Install Android Sdk
      • Identify Customers
      • Push Notification Integration
    • iOS SDK
      • Install iOS Sdk
      • Tracking User
      • Tracking Events
      • Push Notification Settings
        • Configure APNS In Growlytics
        • Configure Mobile App For Push
        • Handling Push Click
    • Other
      • Upload Customers using CSV
  • Channel Integrations
    • Email
      • Amazon SES
      • SendGrid
      • Custom SMTP
    • Mobile Push Notifications
      • Configure FCM Channel
    • Web Push Notifications
    • Ad Networks
      • Facebook Audiences
      • Google Ad Audiences
  • REST APIs
    • Overview
    • Tracking Users (Shopify Only)
    • Tracking Users (Non-shopify)
    • Tracking Events (Shopify Only)
    • Tracking Events (Non-shopify)
    • Syncing Products
    • Mobile App Apis
  • Webhooks
    • Coupon Webhook
    • Connector Webhooks
Powered by GitBook
On this page
  • Login Customer
  • Logout Customer
  • Guidelines

Was this helpful?

  1. Sdk Integrations
  2. iOS SDK

Tracking User

Growlytics ios SDK starts tracking users as soon as the app launches. Each time user installs app and opens for first time, Growlytics SDK automatically creates an anonymous customer for given device. All their behavioral data and session data (Events & Customer Attributes) are stored under the anonymous profile.

When customer logs-in or registers with your app's login options, all anonmous behaviour data captured earlier will be merged with logged in customer's behaviour data.

Login Customer

Use loginUser method to create a customer profile in Growlytics and sync behavioral data with this identified customer. The login method accepts two parameters:

  1. SystemId: This is the id that you use to identify customer in your system.

  2. Customer Attributes: Custom attributes you want to track for given user.

import Growlytics

class MyController: UIViewController {

    func yourLoginFunction() {
    
        /**
            Your Login Logic
        **/
        
        // Build Customer Attributes To Pass To Growlytics.
        let customerAttributes: [String:Any] = [
            // Reserved customer properties (Used in campaigns)
            name: 'John Wick',
            email: 'john@gmail.com',
            mobile: '9876543210',
            
            // Custom properties
            subscriptionType: 'pro',
            region: 'Mumbai',
            totalPurchaseTillNow: 30000
        ]
        // Login User To Growlytics.
        Analytics.getInstance().loginUser("Custome_ID", customerAttributes)
        
    }
}

Once login method is called:

  1. The user is identified (they become Known Users in your dashboard).

  2. A new, Known User Profile is created for them that contains all their data.

  3. All their previous anonymous profiles are merged with the new Known User Profile to create a single unified view of your users. (This means that data from their first visit to your website to their latest interactions can all be found under a single user profile!)

Make sure you call login as soon as the user logs in to your application, or whenever earliest you are able to identify the user.

How User Profiles are Merged When User is Identified (assigned a CUID by you)

Let's assume that User A visits your website a few times before signing up.

User A visits your website on Day 1: Growlytics assigns them an LUID and automatically creates an anonymous user profile containing all their data (Anonymous Profile 1).

User A revisits your website on Day 3: Growlytics assigns them an LUID and creates another anonymous profile to record all their data (Anonymous Profile 2).

User A revisits your website on Day 7 and creates an account: On account creation, you can choose to assign the user a CUID. This will lead to the creation of a new user profile.

  • As soon as the Known User Profile is created, Growlytics will run a quick check in it's backend to identify all the existing anonymous user profiles of the user that were created on their previous visits.

  • In this case, Anonymous Profile 1 and Anonymous Profile 2 will be merged with the final profile of User A to provide a unified view of their preferences and behavioral history.

Logout Customer

Make sure you call logout when the logged-in user logs out, or you do not want to attach any future event, session or user data with this user, until login is called again.

import Growlytics

class MyController: UIViewController {

    func yourLogoutFunction() {
    
        /**
            Your Logout Logic
        **/
        
        // Logout User From Growlytics.
        Analytics.getInstance().logoutUser()
        
    }
}

Guidelines

  • An ID can have of maximum 100 characters.

  • A user ID cannot be changed once it has been assigned.

  • Although ID can be any String that uniquely identifies users in your system, we recommend using system-generated user IDs from your database instead of information that can change over time such as email addresses, usernames, or phone numbers.

PreviousInstall iOS SdkNextTracking Events

Last updated 1 year ago

Was this helpful?