Ir al contenido

API Reference

Esta página resume los entry points públicos visibles en el código Kotlin compartido.

Responsabilidades principales:

  • inicializar el runtime del SDK
  • cargar las definiciones de popup
  • adjuntar un contexto de plataforma
  • evaluar triggers y encolar popups
  • renderizar las experiencias de popup y encuesta
  • emitir eventos de ciclo de vida del popup
  • init(options: InitOptions)
  • initialize(options: InitOptions)
  • autoLaunch()
  • attachContext(context: PlatformContext)
  • setPath(path: String?)
  • onScroll(percentage: Int)
  • onExit()
  • triggerEvent(eventName: String)
  • triggerClick(targetId: String)
  • show(options: ShowOptions, context: PlatformContext)
  • showByPopupId(popupId: String, context: PlatformContext)
  • triggerSurvey(surveyId: String, context: PlatformContext, popupId: String? = null)
  • on(event: Event, listener: (EventData) -> Unit)
  • off(event: Event, listener: (EventData) -> Unit)
  • track(name: String, params: Map<String, Any?>? = null)
  • setUserAttributes(attributes: Map<String, Any?>) — dimensiones por las que desglosar los informes. Viven solo en memoria, así que vuelve a fijarlas después de cada init().
  • setMetric(key: String, value: Any?) — valores medibles, enviados en el campo dedicado feedback.metrics del payload. Se reenvían en cada flush y viven solo en memoria, igual que los atributos de arriba.
  • suspend setContactAttributes(attributes: Map<String, Any?>): Boolean
  • setUserId(userId: String? = null)
  • setTrackingEnabled(enabled: Boolean)
  • endSession()
  • enterMiniService(name: String, entryPointType: String? = null) / exitMiniService(name: String)

Ver Analytics para saber qué registra cada uno.

  • environment: Environment — de solo lectura, refleja el backend al que apunta el SDK tras init() (por defecto Environment.Production). Útil para afirmar en tiempo de ejecución qué backend está usando un publicKey dado.

El objeto Deepdots ofrece helpers de utilidad:

  • create()
  • createInitialized(options)
  • now()
  • parseHtml(html)
  • dismiss(context)
  • getSurveyHtml(surveyId, productId)
  • createInitializedSimple(...)

El repositorio también ofrece helpers de scroll en Android:

  • bindRecyclerView(recyclerView: RecyclerView)
  • bindScrollView(scrollView: ScrollView)

Ayudan a traducir el scroll del host en actualizaciones de onScroll(...) para la evaluación de triggers.