Class PianoAnalytics


  • public final class PianoAnalytics
    extends Object
    • Method Detail

      • getInstance

        public static PianoAnalytics getInstance​(@NonNull
                                                 Context ctx)
        Simple default getInstance
        Parameters:
        ctx - activity context
      • getInstance

        public static PianoAnalytics getInstance​(@NonNull
                                                 Context ctx,
                                                 @NonNull
                                                 String configFileLocation)
        Specific getInstance
        Parameters:
        ctx - activity context
        configFileLocation - file path from assets folder
      • sendEvent

        public void sendEvent​(@NonNull
                              Event event)
        Send event data
        Parameters:
        event - a custom event
      • sendEvent

        public void sendEvent​(@NonNull
                              Event event,
                              Configuration config)
        Send event data
        Parameters:
        event - a custom event
        config - custom config used only for this action
      • sendEvent

        public void sendEvent​(@NonNull
                              Event event,
                              Configuration config,
                              PianoAnalytics.OnWorkListener l)
        Send event data
        Parameters:
        event - a custom event
        config - custom config used only for this action
        l - work listener to leave customer handling
      • sendEvents

        public void sendEvents​(@NonNull
                               List<Event> events)
        Send events data
        Parameters:
        events - a custom event list
      • sendEvents

        public void sendEvents​(@NonNull
                               List<Event> events,
                               Configuration config)
        Send events data
        Parameters:
        events - a custom event list
        config - custom config used only for this action
      • sendEvents

        public void sendEvents​(@NonNull
                               List<Event> events,
                               Configuration config,
                               PianoAnalytics.OnWorkListener l)
        Send events data
        Parameters:
        events - a custom event list
        config - custom config used only for this action
        l - work listener to leave customer handling
      • setConfiguration

        public void setConfiguration​(Configuration.ConfigurationKey key,
                                     String value)
        Update configuration
        Parameters:
        key - configuration key
        value - configuration value
      • setConfiguration

        public void setConfiguration​(@NonNull
                                     Configuration config)
        Update configuration
        Parameters:
        config - configuration object
      • setProperty

        public void setProperty​(String key,
                                Object value)
        Update customer context
        Parameters:
        key - property key
        value - property value
      • setProperty

        public void setProperty​(String key,
                                Object value,
                                Boolean persistent)
        Update customer context
        Parameters:
        key - property key
        value - property value
        persistent - whether the property will be persistent or not
      • setProperty

        public void setProperty​(String key,
                                Object value,
                                Boolean persistent,
                                String[] events)
        Update customer context
        Parameters:
        key - property key
        value - property value
        persistent - whether the property will be persistent or not
        events - will send the property only those specific events
      • setProperties

        public void setProperties​(@NonNull
                                  Map<String,​Object> data)
        dictionary of properties to set
        Parameters:
        data - property key
      • setProperties

        public void setProperties​(@NonNull
                                  Map<String,​Object> data,
                                  Boolean persistent)
        dictionary of properties to set
        Parameters:
        data - property key
        persistent - whether the property will be persistent or not
      • setProperties

        public void setProperties​(@NonNull
                                  Map<String,​Object> data,
                                  Boolean persistent,
                                  String[] events)
        dictionary of properties to set
        Parameters:
        data - property key
        persistent - whether the property will be persistent or not
        events - will send the property only those specific events
      • deleteProperty

        public void deleteProperty​(@NonNull
                                   String key)
        Delete property from customer context
        Parameters:
        key - customer context property key
      • setUser

        public void setUser​(@NonNull
                            String userId)
        Set user
        Parameters:
        userId - new user id
      • setUser

        public void setUser​(@NonNull
                            String userId,
                            String userCategory)
        Set user
        Parameters:
        userId - new user id
        userCategory - new user category
      • setUser

        public void setUser​(@NonNull
                            String userId,
                            String userCategory,
                            boolean enableStorage)
        Set user
        Parameters:
        userId - new user id
        userCategory - new user category
        enableStorage - to store user in user defaults
      • deleteUser

        public void deleteUser()
        Delete user
      • privacyCreateMode

        public void privacyCreateMode​(@NonNull
                                      String mode,
                                      boolean consent)
        Create privacy context
        Parameters:
        mode - a new privacy visitor mode
        consent - if user consented
      • privacySetMode

        public void privacySetMode​(@NonNull
                                   String mode)
        Update privacy context
        Parameters:
        mode - a privacy visitor mode
      • privacyIncludeEvent

        public void privacyIncludeEvent​(String eventName)
        add privacy visitor mode authorized events name
        Parameters:
        eventName - string of an event name appended with what is currently set
      • privacyIncludeEvent

        public void privacyIncludeEvent​(String eventName,
                                        String[] privacyModes)
        add privacy visitor mode authorized events name
        Parameters:
        eventName - string of an event name appended with what is currently set
        privacyModes - a privacy visitor mode
      • privacyIncludeEvents

        public void privacyIncludeEvents​(@NonNull
                                         String[] eventsName)
        add privacy visitor mode authorized events name
        Parameters:
        eventsName - string set of events name appended with currently set
      • privacyIncludeEvents

        public void privacyIncludeEvents​(@NonNull
                                         String[] eventsName,
                                         String[] privacyModes)
        add privacy visitor mode authorized events name
        Parameters:
        eventsName - string set of events name appended with currently set
        privacyModes - a set of privacy visitor modes or by default applies to all modes
      • privacyExcludeEvent

        public void privacyExcludeEvent​(String eventName)
        add privacy visitor mode forbidden events name
        Parameters:
        eventName - string of an event name appended with what is currently set
      • privacyExcludeEvent

        public void privacyExcludeEvent​(String eventName,
                                        String[] privacyModes)
        add privacy visitor mode forbidden events name
        Parameters:
        eventName - string of an event name appended with what is currently set
        privacyModes - a privacy visitor mode
      • privacyExcludeEvents

        public void privacyExcludeEvents​(@NonNull
                                         String[] eventsName)
        add privacy visitor mode forbidden events name
        Parameters:
        eventsName - string set of events name appended with currently set
      • privacyExcludeEvents

        public void privacyExcludeEvents​(@NonNull
                                         String[] eventsName,
                                         String[] privacyModes)
        add privacy visitor mode forbidden events name
        Parameters:
        eventsName - string set of events name appended with currently set
        privacyModes - a privacy visitor mode
      • privacyIncludeProperty

        public void privacyIncludeProperty​(@NonNull
                                           String property)
        add privacy visitor mode authorized properties on events
        Parameters:
        property - string property appended with what is currently set
      • privacyIncludeProperty

        public void privacyIncludeProperty​(@NonNull
                                           String property,
                                           String[] privacyModes)
        add privacy visitor mode authorized properties on events
        Parameters:
        property - string property appended with what is currently set
        privacyModes - array of privacy modes on which we will authorize the properties, by default we authorize the properties for all the privacy modes
      • privacyIncludeProperty

        public void privacyIncludeProperty​(@NonNull
                                           String property,
                                           String[] privacyModes,
                                           String[] eventNames)
        add privacy visitor mode authorized properties on events
        Parameters:
        property - string property appended with what is currently set
        privacyModes - array of privacy modes on which we will authorize the properties, by default we authorize the properties for all the privacy modes
        eventNames - string property appended with what is currently set
      • privacyIncludeProperties

        public void privacyIncludeProperties​(@NonNull
                                             String[] properties)
        add privacy visitor mode authorized properties on events
        Parameters:
        properties - string array of properties to authorize
      • privacyIncludeProperties

        public void privacyIncludeProperties​(@NonNull
                                             String[] properties,
                                             String[] privacyModes)
        add privacy visitor mode authorized properties on events
        Parameters:
        properties - string array of properties to authorize
        privacyModes - string array of modes to apply authorization
      • privacyIncludeProperties

        public void privacyIncludeProperties​(@NonNull
                                             String[] properties,
                                             String[] privacyVisitorModes,
                                             String[] eventNames)
        add privacy visitor mode authorized properties on events
        Parameters:
        properties - string array of properties to authorize
        privacyVisitorModes - string array of modes to apply authorization
        eventNames - string array of event names to apply authorization
      • privacyExcludeProperty

        public void privacyExcludeProperty​(@NonNull
                                           String property)
        add privacy visitor mode forbidden properties on events
        Parameters:
        property - string property appended with what is currently set
      • privacyExcludeProperty

        public void privacyExcludeProperty​(@NonNull
                                           String property,
                                           String[] privacyModes)
        add privacy visitor mode forbidden properties on events
        Parameters:
        property - string property appended with what is currently set
        privacyModes - string array of modes to apply forbiddance
      • privacyExcludeProperty

        public void privacyExcludeProperty​(@NonNull
                                           String property,
                                           String[] privacyModes,
                                           String[] eventNames)
        add privacy visitor mode forbidden properties on events
        Parameters:
        property - string property appended with what is currently set
        privacyModes - string array of modes to apply forbiddance
        eventNames - string array of event names to apply forbiddance
      • privacyExcludeProperties

        public void privacyExcludeProperties​(@NonNull
                                             String[] properties)
        add privacy visitor mode forbidden properties on events
        Parameters:
        properties - string array of properties to forbid
      • privacyExcludeProperties

        public void privacyExcludeProperties​(@NonNull
                                             String[] properties,
                                             String[] privacyModes)
        add privacy visitor mode forbidden properties on events
        Parameters:
        properties - string array of properties to forbid
        privacyModes - string array of modes to apply forbiddance
      • privacyExcludeProperties

        public void privacyExcludeProperties​(@NonNull
                                             String[] properties,
                                             String[] privacyModes,
                                             String[] eventNames)
        add privacy visitor mode forbidden properties on events
        Parameters:
        properties - string array of properties to forbid
        privacyModes - string array of modes to apply forbiddance
        eventNames - string array of event names to apply forbiddance
      • privacyIncludeStorageKey

        public void privacyIncludeStorageKey​(@NonNull
                                             PianoAnalytics.PrivacyStorageFeature storageKey)
        add privacy visitor mode storage
        Parameters:
        storageKey - string of authorized key to store data into device
      • privacyIncludeStorageKey

        public void privacyIncludeStorageKey​(@NonNull
                                             PianoAnalytics.PrivacyStorageFeature storageKey,
                                             String[] privacyModes)
        add privacy visitor mode storage
        Parameters:
        storageKey - string of authorized key to store data into device
        privacyModes - an array of privacy visitor modes on which to include these keys
      • privacyIncludeStorageKeys

        public void privacyIncludeStorageKeys​(@NonNull
                                              PianoAnalytics.PrivacyStorageFeature[] storageKeys)
        add privacy visitor mode storage
        Parameters:
        storageKeys - PrivacyStorageFeature set of authorized features to store data into device
      • privacyIncludeStorageKeys

        public void privacyIncludeStorageKeys​(@NonNull
                                              PianoAnalytics.PrivacyStorageFeature[] storageKeys,
                                              String[] privacyModes)
        add privacy visitor mode storage
        Parameters:
        storageKeys - PrivacyStorageFeature set of authorized features to store data into device
        privacyModes - an array of privacy visitor modes on which to include these keys
      • privacyExcludeStorageKey

        public void privacyExcludeStorageKey​(@NonNull
                                             PianoAnalytics.PrivacyStorageFeature storageKey)
        exclude privacy visitor mode storage
        Parameters:
        storageKey - string of forbidden key to store data into device
      • privacyExcludeStorageKey

        public void privacyExcludeStorageKey​(@NonNull
                                             PianoAnalytics.PrivacyStorageFeature storageKey,
                                             String[] privacyModes)
        exclude privacy visitor mode storage
        Parameters:
        storageKey - string of forbidden key to store data into device
        privacyModes - an array of privacy visitor modes on which to include these keys
      • privacyExcludeStorageKeys

        public void privacyExcludeStorageKeys​(@NonNull
                                              PianoAnalytics.PrivacyStorageFeature[] storageKeys)
        exclude privacy visitor mode storage
        Parameters:
        storageKeys - PrivacyStorageFeature set of forbidden features to store data into device
      • privacyExcludeStorageKeys

        public void privacyExcludeStorageKeys​(@NonNull
                                              PianoAnalytics.PrivacyStorageFeature[] storageKeys,
                                              String[] privacyModes)
        exclude privacy visitor mode storage
        Parameters:
        storageKeys - PrivacyStorageFeature set of forbidden features to store data into device
        privacyModes - an array of privacy visitor modes on which to include these keys
      • sendOfflineData

        public void sendOfflineData()
        send offline data stored on device
      • sendOfflineData

        public void sendOfflineData​(Configuration config)
        send offline data stored on device
        Parameters:
        config - custom config used only for this action
      • sendOfflineData

        public void sendOfflineData​(Configuration config,
                                    PianoAnalytics.OnWorkListener l)
        send offline data stored on device
        Parameters:
        config - custom config used only for this action
        l - work listener to leave customer handling
      • deleteOfflineStorage

        public void deleteOfflineStorage()
        delete offline data stored on device
      • deleteOfflineStorage

        public void deleteOfflineStorage​(int remaining)
        delete offline data stored on device and keep only remaining days
        Parameters:
        remaining - age of data which have to be kept (in days)
      • setVisitorId

        public void setVisitorId​(String visitorId)
        Set current visitor id
        Parameters:
        visitorId - custom visitor id to force in upcoming events
      • getModel

        public void getModel​(@NonNull
                             PianoAnalytics.OnGetModelListener l)
        Get all data in the model
        Parameters:
        l - listener which have to be implemented to get data