Permutive

Handles identity management, lifecycle, and is the entry point to event tracking (via Permutive.eventTracker call) and segments and triggers (via Permutive.triggersProvider).

To create use the constructor or the Permutive.Builder class. If you wish to stop using the Permutive object, call Permutive.close and this will release all resources.

To add an alias to the current identity, call Permutive.setIdentity.

Constructors

Link copied to clipboard
fun Permutive(context: Context, projectId: UUID, apiKey: UUID, aliasProviders: List<AliasProvider> = emptyList<com.permutive.android.identity.AliasProvider>(), identity: String? = null, customAliases: List<Alias> = emptyList<com.permutive.android.Alias>(), unused: Boolean = true)

Constructs a Permutive object.

Link copied to clipboard
fun Permutive(context: Context, workspaceId: UUID, apiKey: UUID, aliasProviders: List<AliasProvider> = emptyList(), identity: String? = null, customAliases: List<Alias> = emptyList())

Constructs a Permutive object.

Types

Link copied to clipboard
class Builder

Build a new Permutive object.

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open suspend override fun clearPersistentData(): Result<Unit>

Clear all persistent data of the current Permutive instance

open override fun clearPersistentData(onSuccess: () -> Unit, onFailure: (Throwable) -> Unit)

Clear all persistent data of the current Permutive instance. Callbacks will run on the main thread.

Link copied to clipboard
open override fun close()
Link copied to clipboard
open override fun createVideoTracker(duration: Long, eventProperties: EventProperties?, title: String?, url: Uri?, referrer: Uri?): MediaTracker

Deprecated, please use trackVideoView: trackVideoView( duration: Long, videoProperties: MediaTracker.VideoProperties?, pageProperties: MediaTracker.PageProperties?, eventProperties: EventProperties? ): MediaTracker

Link copied to clipboard
open override fun currentUserId(): String
Link copied to clipboard

Create an EventTracker object. Any number of these may be created.

Link copied to clipboard
open override fun logger(): Logger
Link copied to clipboard
open override fun recordAppNexusAdImpression(auctionId: String?, buyerMemberId: Int?, creativeId: String?, source: String?, type: String?, height: Int?, tagId: String?, targeting: List<Pair<String, String>>)
Link copied to clipboard
open override fun recordAppNexusTargeting(cohortIdsAttached: List<String>)
Link copied to clipboard
open override fun recordGamTargeting(cohortIdsAttached: List<String>)
Link copied to clipboard
open override fun sessionId(): String?
Link copied to clipboard
open override fun setDeveloperMode(enable: Boolean)

Enable/disable developer mode which will log more information to the console.

Link copied to clipboard
open override fun setIdentity(identity: String)

Associate an alias with the current user with lowest priority that never expires. Forces segments and queries to be updated with the associated identity, if there is one on the server.

open override fun setIdentity(aliases: List<Alias>)

Associate an list of aliases with the current user. Aliases are resolved in the order given. Forces segments and queries to be updated with the associated identity, if there is one on the server.

open override fun setIdentity(identity: String, priority: Int?, expiry: Date?)

Associate an alias with the current user. Forces segments and queries to be updated with the associated identity, if there is one on the server. Aliases will be deleted when their expiry is in the past.

Link copied to clipboard
open override fun setReferrer(referrer: Uri?)

Set the referrer context, used when tracking events.

Link copied to clipboard
open override fun setTitle(title: String?)

Set the title context, used when tracking events.

Link copied to clipboard
open override fun setUrl(url: Uri?)

Set the url context, used when tracking events.

Link copied to clipboard
open override fun <T> trackApiCall(name: ApiFunction, func: () -> T): T
Link copied to clipboard
open override fun trackPage(eventProperties: EventProperties?, title: String?, url: Uri?, referrer: Uri?): PageTracker

Create a page tracker object with the given context & properties. A PageTracker object will automatically track a Pageview and PageviewComplete events upon creation and closing of the PageTracker object.

Link copied to clipboard
open override fun trackVideoAdView(durationMs: Long, adProperties: AdTracker.AdProperties?, pageProperties: MediaTracker.PageProperties?, customEventProperties: EventProperties?): AdTracker

Track a VideoAdView event and return an AdTracker for tracking video ad playback and interaction.

Link copied to clipboard
open override fun trackVideoView(durationMilliseconds: Long, videoProperties: MediaTracker.VideoProperties?, pageProperties: MediaTracker.PageProperties?, customEventProperties: EventProperties?): MediaTracker

Track a Videoview event and return a MediaTracker for tracking user interaction with video content.

Link copied to clipboard

Create a TriggersProvider object. Any number of these may be created.

Link copied to clipboard
open override fun viewId(): String?
Link copied to clipboard
open override fun workspaceId(): String

Properties

Link copied to clipboard
open override val currentActivations: Map<String, List<String>>
Link copied to clipboard
open override val currentCohorts: List<String>
Link copied to clipboard
open override val currentMetrics: SdkMetrics

Property containing basic metrics of the SDK

Link copied to clipboard
open override val currentReactions: Map<String, List<Int>>
Link copied to clipboard
open override val currentSegments: List<Int>