Class MyTrackerParams

java.lang.Object
com.my.tracker.MyTrackerParams

public final class MyTrackerParams extends Object
Class for specifying additional tracking parameters
  • Constructor Details

    • MyTrackerParams

      public MyTrackerParams()
  • Method Details

    • getAge

      @AnyThread public int getAge()
      Return age of the current user.
      Returns:
      The user's age.
    • setAge

      @AnyThread @NonNull public MyTrackerParams setAge(int age)
      Set age for the current user.
      Parameters:
      age - User's age.
      Returns:
      The current instance of MyTrackerParams.
    • getGender

      @AnyThread public int getGender()
      Return gender of the current user. Possible values are defined in MyTrackerParams.Gender
      Returns:
      The user's gender.
    • setGender

      @AnyThread @NonNull public MyTrackerParams setGender(int gender)
      Set gender for the current user.
      Parameters:
      gender - User's gender value that defined in MyTrackerParams.Gender.
      Returns:
      The current instance of MyTrackerParams.
    • getLang

      @AnyThread @Nullable public String getLang()
      Return current language. The value can differ from the current language of the system.
      Returns:
      Current language.
    • setLang

      @AnyThread @NonNull public MyTrackerParams setLang(@Nullable String lang)
      Set current language. You could use this method to override the system value of the language.
      Parameters:
      lang - Current language.
      Returns:
      The current instance of MyTrackerParams.
    • getMrgsAppId

      @AnyThread @Nullable public String getMrgsAppId()
      Return MRGS application id.
      Returns:
      MRGS application id.
    • setMrgsAppId

      @AnyThread @NonNull public MyTrackerParams setMrgsAppId(@Nullable String appId)
      Set MRGS application id.
      Parameters:
      appId - MRGS application id.
      Returns:
      The current instance of MyTrackerParams.
    • getMrgsId

      @AnyThread @Nullable public String getMrgsId()
      Return current MRGS device id.
      Returns:
      MRGS device id.
    • setMrgsId

      @AnyThread @NonNull public MyTrackerParams setMrgsId(@Nullable String mrgsId)
      Set MRGS device id.
      Parameters:
      mrgsId - MRGS device id.
      Returns:
      The current instance of MyTrackerParams.
    • getMrgsUserId

      @AnyThread @Nullable public String getMrgsUserId()
      Return MRGS id of the current user.
      Returns:
      The current user's MRGS id.
    • setMrgsUserId

      @AnyThread @NonNull public MyTrackerParams setMrgsUserId(@Nullable String userId)
      Set MRGS id for the current user.
      Parameters:
      userId - User's MRGS id.
      Returns:
      The current instance of MyTrackerParams.
    • getCustomUserId

      @AnyThread @Nullable public String getCustomUserId()
      Return identifier of the current user. If setCustomUserIds(String[]) was called, then the first array item will be returned.
      Returns:
      first user's id or null.
    • setCustomUserId

      @AnyThread @NonNull public MyTrackerParams setCustomUserId(@Nullable String id)
      Set identifier of the current user. This method overrides the value of setCustomUserIds(String[]).

      If custom user ids are changed, then myTracker will send all saved events to the server (with previous custom ids).

      Parameters:
      id - user's identifier or null.
      Returns:
      The current instance of MyTrackerParams.
    • getCustomUserIds

      @AnyThread @Nullable public String[] getCustomUserIds()
      Return identifiers of the current user. If setCustomUserId(String) was called, then single item array will be returned.

      Don't change this array - it contains independent copy of data. Use setCustomUserId(String) or setCustomUserIds(String[]) to change custom user identifiers.

      Returns:
      user's identifiers or null.
    • setCustomUserIds

      @AnyThread @NonNull public MyTrackerParams setCustomUserIds(@Nullable String[] ids)
      Set identifiers of the current user. This method overrides the value of setCustomUserId(String).

      If custom user ids are changed, then myTracker will send all saved events to the server (with previous custom ids).

      Parameters:
      ids - user's identifiers or null. Zero-length array is replaced with null.
      Returns:
      The current instance of MyTrackerParams.
    • getEmail

      @AnyThread @Nullable public String getEmail()
      Return email of the current user. If setEmails(String[]) was called, then the first email will be returned.
      Returns:
      first user's email or null.
    • setEmail

      @AnyThread @NonNull public MyTrackerParams setEmail(@Nullable String email)
      Set email of the current user. This method overrides the value of setEmails(String[]).
      Parameters:
      email - user's email or null.
      Returns:
      The current instance of MyTrackerParams.
    • getEmails

      @AnyThread @Nullable public String[] getEmails()
      Return emails of the current user. If setEmail(String) was called, then single item array will be returned.

      Don't change this array - it contains independent copy of data. Use setEmail(String) or setEmails(String[]) to change user emails.

      Returns:
      user's emails or null.
    • setEmails

      @AnyThread @NonNull public MyTrackerParams setEmails(@Nullable String[] emails)
      Set emails of the current user. This method overrides the value if setEmail(String).
      Parameters:
      emails - user's emails or null. Zero-length array is replaced with null.
      Returns:
      The current instance of MyTrackerParams.
    • getIcqId

      @AnyThread @Nullable public String getIcqId()
      Return ICQ id of the current user. If setIcqIds(String[]) was called, then the first id will be returned.
      Returns:
      first user's ICQ id or null.
    • setIcqId

      @AnyThread @NonNull public MyTrackerParams setIcqId(@Nullable String id)
      Set ICQ id of the current user. This method overrides the value of setIcqIds(String[]).
      Parameters:
      id - user's ICQ id or null.
      Returns:
      The current instance of MyTrackerParams.
    • getIcqIds

      @AnyThread @Nullable public String[] getIcqIds()
      Return ICQ ids of the current user. If setIcqId(String) was called, then single item array will be returned.

      Don't change this array - it contains independent copy of data. Use setIcqId(String) or setIcqIds(String[]) to change user ICQ ids.

      Returns:
      user's ICQ ids or null.
    • setIcqIds

      @AnyThread @NonNull public MyTrackerParams setIcqIds(@Nullable String[] ids)
      Set ICQ ids of the current user. This method overrides the value if setIcqId(String).
      Parameters:
      ids - user's ICQ ids or null. Zero-length array is replaced with null.
      Returns:
      The current instance of MyTrackerParams.
    • getOkId

      @AnyThread @Nullable public String getOkId()
      Return OK id of the current user. If setOkIds(String[]) was called, then the first id will be returned.
      Returns:
      first user's OK id or null.
    • setOkId

      @AnyThread @NonNull public MyTrackerParams setOkId(@Nullable String id)
      Set OK id of the current user. This method overrides the value of setOkIds(String[]).
      Parameters:
      id - user's OK id or null.
      Returns:
      The current instance of MyTrackerParams.
    • getOkIds

      @AnyThread @Nullable public String[] getOkIds()
      Return OK ids of the current user. If setOkId(String) was called, then single item array will be returned.

      Don't change this array - it contains independent copy of data. Use setOkId(String) or setOkIds(String[]) to change user OK ids.

      Returns:
      user's OK ids or null.
    • setOkIds

      @AnyThread @NonNull public MyTrackerParams setOkIds(@Nullable String[] ids)
      Set OK ids of the current user. This method overrides the value if setOkId(String) (String)}.
      Parameters:
      ids - user's OK ids or null. Zero-length array is replaced with null.
      Returns:
      The current instance of MyTrackerParams.
    • getVkId

      @AnyThread @Nullable public String getVkId()
      Return VK id of the current user. If setVkIds(String[]) was called, then the first id will be returned.
      Returns:
      first user's VK id or null.
    • setVkId

      @AnyThread @NonNull public MyTrackerParams setVkId(@Nullable String id)
      Set VK id of the current user. This method overrides the value of setVkIds(String[]).
      Parameters:
      id - user's VK id or null.
      Returns:
      The current instance of MyTrackerParams.
    • getVkIds

      @AnyThread @Nullable public String[] getVkIds()
      Return VK ids of the current user. If setVkId(String) was called, then single item array will be returned.

      Don't change this array - it contains independent copy of data. Use setVkId(String) or setVkIds(String[]) to change user VK ids.

      Returns:
      user's VK ids or null.
    • setVkIds

      @AnyThread @NonNull public MyTrackerParams setVkIds(@Nullable String[] ids)
      Set VK ids of the current user. This method overrides the value if setVkId(String) (String)}.
      Parameters:
      ids - user's VK ids or null. Zero-length array is replaced with null.
      Returns:
      The current instance of MyTrackerParams.
    • getPhone

      @AnyThread @Nullable public String getPhone()
      Return phone of the current user. If setPhones(String[]) was called, then the first phone will be returned.
      Returns:
      first user's phone number or null.
    • setPhone

      @AnyThread @NonNull public MyTrackerParams setPhone(@Nullable String phone)
      Set phone of the current user. This method overrides the value of setPhones(String[]).
      Parameters:
      phone - user's phone number or null.
      Returns:
      The current instance of MyTrackerParams.
    • getPhones

      @AnyThread @Nullable public String[] getPhones()
      Return phone numbers of the current user. If setPhone(String) was called, then single item array will be returned.

      Don't change this array - it contains independent copy of data. Use setPhone(String) or setPhones(String[]) to change user phone numbers.

      Returns:
      user's phone numbers or null.
    • setPhones

      @AnyThread @NonNull public MyTrackerParams setPhones(@Nullable String[] phones)
      Set phones of the current user. This method overrides the value if setPhone(String) (String)}.
      Parameters:
      phones - user's phone numbers or null. Zero-length array is replaced with null.
      Returns:
      The current instance of MyTrackerParams.
    • getVkConnectId

      @AnyThread @Nullable public String getVkConnectId()
      Return VK connect id of the current user. If setVkConnectIds(String[]) was called, then the first id will be returned.
      Returns:
      first user's VK connect id or null.
    • setVkConnectId

      @AnyThread @NonNull public MyTrackerParams setVkConnectId(@Nullable String id)
      Set VK connect id of the current user. This method overrides the value * of setVkIds(String[]).
      Parameters:
      id - user's VK connect id or null.
      Returns:
      The current instance of MyTrackerParams.
    • getVkConnectIds

      @AnyThread @Nullable public String[] getVkConnectIds()
      Return VK connect ids of the current user. If setVkConnectId(String) was called, then single item array will be returned.

      Don't change this array - it contains independent copy of data. Use setVkConnectId(String) or setVkConnectIds(String[]) to change user VK connect ids.

      Returns:
      user's VK connect ids or null.
    • setVkConnectIds

      @AnyThread @NonNull public MyTrackerParams setVkConnectIds(@Nullable String[] ids)
      Set VK connect ids of the current user. This method overrides the value if setVkConnectId(String) (String)} (String)}.
      Parameters:
      ids - user VK connect ids or null. Zero-length array is replaced with null.
      Returns:
      The current instance of MyTrackerParams.
    • setCustomParam

      @AnyThread @NonNull public MyTrackerParams setCustomParam(@NonNull String key, @Nullable String value)
      Set custom param for sending data.

      Use null value to remove specified param.

      Parameters:
      key - param key(case insensitive)
      value - param value or null
    • getCustomParam

      @AnyThread @Nullable public String getCustomParam(@NonNull String key)
      Return custom param previously set with setCustomParam(String, String) or null.
      Parameters:
      key - param key (case insensitive)
      Returns:
      param value or null
    • addChangeListener

      @AnyThread public void addChangeListener(@NonNull com.my.tracker.core.utils.Consumer<com.my.tracker.core.UserInfoState> onInit, @NonNull com.my.tracker.core.utils.Consumer<com.my.tracker.core.UserInfoState> onChange)
    • getReadOnlyCopy

      @RestrictTo(LIBRARY) @NonNull public MyTrackerParams.ReadOnlyCopy getReadOnlyCopy()