-
public class EloThe entry point for the Elo SDK.
Configure once early in your app lifecycle (typically
Application.onCreate), then call loadAd from anywhere to fetch a contextual ad based on the surrounding chat history.class MyApp : Application() { override fun onCreate() { super.onCreate() Elo.configure( context = this, publisherId = "YOUR_PUBLISHER_ID", adUnitId = "YOUR_AD_UNIT_ID", ) } }For mediation adapters and other options, use the configure overload that takes a full EloConfiguration.
Mirrors
iOS Sources/EloAds/Elo.swift.
-
-
Field Summary
Fields Modifier and Type Field Description private final static StringsdkVersionprivate final static BooleanisDisabledpublic final static EloINSTANCE
-
Method Summary
Modifier and Type Method Description final static Unitinitialize(Context context, String publisherId, String adUnitId, Boolean coppa, Boolean tfua)Initialize the SDK. final static Unitinitialize(Context context, String publisherId, String adUnitId, Boolean coppa)Initialize the SDK. final static Unitinitialize(Context context, String publisherId, String adUnitId)Initialize the SDK. final static Unitconfigure(Context context, String publisherId, String adUnitId, Boolean shareGeoLocation, Integer geoLocationPrecision)Configure the SDK with Elo demand only. final static Unitconfigure(Context context, String publisherId, String adUnitId, Boolean shareGeoLocation)Configure the SDK with Elo demand only. final static Unitconfigure(Context context, String publisherId, String adUnitId)Configure the SDK with Elo demand only. final static Unitconfigure(Context context, EloConfiguration configuration)Configure the SDK. final static Unitdisable()Pause new ad requests without tearing down the SDK. final static Unitenable()Re-enable ad requests after a previous disable. final static UnitsetListener(EloAdListener listener)Register a listener for ad lifecycle callbacks. final static UnitsetShareGeoLocation(Boolean enabled)Enable or disable Prebid-style passive geo sharing for future ad requests without reconfiguring the SDK. final static UnitsetUserIdentifier(String identifier)Identify the signed-in user with your own stable identifier. final static UnitsetUserData(EloUserData userData)Share what you know about the signed-in user with ad requests. final static UnitsetUserIdentity(String userIdentifier, EloUserData userData)Set both halves of the user's identity in one write. final static UnitsetRequestPayloadCaptureEnabled(Boolean enabled)Enable capture of each ad operation's redacted Elo request payload and decoded ad response into diagnostics (EloDiagnosticsEntry. final static AdResultloadAd(List<ChatMessage> messages, List<ContextObject> contextObjects, AdDisplayPosition displayPosition)Load an ad for the given chat context. final static AdResultloadAd(List<ChatMessage> messages, List<ContextObject> contextObjects)Load an ad for the given chat context. final static AdResultloadAd(List<ChatMessage> messages)Load an ad for the given chat context. final static UnitpreloadAd(List<ChatMessage> messages, List<ContextObject> contextObjects, AdDisplayPosition displayPosition)Warm the in-memory ad cache for the given chat context. final static UnitpreloadAd(List<ChatMessage> messages, List<ContextObject> contextObjects)Warm the in-memory ad cache for the given chat context. final static UnitpreloadAd(List<ChatMessage> messages)Warm the in-memory ad cache for the given chat context. final static UnittrackRender(EloAd ad)Manual render-time hook for fully-custom views. final static UnittrackImpression(EloAd ad)Manual impression hook for fully-custom views. final static UnittrackClick(EloAd ad)Manual click hook for fully-custom views. final static EloMediationDebugSnapshotmediationDebugSnapshot()A read-only snapshot of adapter and auction state for debugging. final static EloDiagnosticsSnapshotdiagnosticsSnapshot()A read-only snapshot of integration health, recent ad operations, and recent tracking outcomes. final static Unitshutdown()Tear down the SDK. final static StringgetSdkVersion()final static BooleangetIsDisabled()-
-
Method Detail
-
initialize
@Deprecated(message = Use Elo.configure(context, publisherId, adUnitId) instead; for COPPA/TFUA build an EloConfiguration and call Elo.configure(context, configuration).)@JvmOverloads() final static Unit initialize(Context context, String publisherId, String adUnitId, Boolean coppa, Boolean tfua)
Initialize the SDK.
Deprecated sugar over configure. Use the
configure(context, publisherId, adUnitId, ...)convenience for the simple Elo-only case, or build an EloConfiguration and callconfigure(context, configuration)for everything else (mediation adapters, COPPA/TFUA,logLevel,baseUrl).
-
initialize
@Deprecated(message = Use Elo.configure(context, publisherId, adUnitId) instead; for COPPA/TFUA build an EloConfiguration and call Elo.configure(context, configuration).)@JvmOverloads() final static Unit initialize(Context context, String publisherId, String adUnitId, Boolean coppa)
Initialize the SDK.
Deprecated sugar over configure. Use the
configure(context, publisherId, adUnitId, ...)convenience for the simple Elo-only case, or build an EloConfiguration and callconfigure(context, configuration)for everything else (mediation adapters, COPPA/TFUA,logLevel,baseUrl).
-
initialize
@Deprecated(message = Use Elo.configure(context, publisherId, adUnitId) instead; for COPPA/TFUA build an EloConfiguration and call Elo.configure(context, configuration).)@JvmOverloads() final static Unit initialize(Context context, String publisherId, String adUnitId)
Initialize the SDK.
Deprecated sugar over configure. Use the
configure(context, publisherId, adUnitId, ...)convenience for the simple Elo-only case, or build an EloConfiguration and callconfigure(context, configuration)for everything else (mediation adapters, COPPA/TFUA,logLevel,baseUrl).
-
configure
@JvmOverloads() final static Unit configure(Context context, String publisherId, String adUnitId, Boolean shareGeoLocation, Integer geoLocationPrecision)
Configure the SDK with Elo demand only.
Convenience overload of configure for the common case — no mediation adapters, default options.
The geo-sharing controls are mirrored here (unlike every other option) because passive geo sharing is on by default and the opt-out should be visible at the simplest entry point. Anything else (mediation adapters, COPPA/TFUA flags, log level) is deliberately not mirrored — build an EloConfiguration and call
configure(context, configuration)instead.
-
configure
@JvmOverloads() final static Unit configure(Context context, String publisherId, String adUnitId, Boolean shareGeoLocation)
Configure the SDK with Elo demand only.
Convenience overload of configure for the common case — no mediation adapters, default options.
The geo-sharing controls are mirrored here (unlike every other option) because passive geo sharing is on by default and the opt-out should be visible at the simplest entry point. Anything else (mediation adapters, COPPA/TFUA flags, log level) is deliberately not mirrored — build an EloConfiguration and call
configure(context, configuration)instead.
-
configure
@JvmOverloads() final static Unit configure(Context context, String publisherId, String adUnitId)
Configure the SDK with Elo demand only.
Convenience overload of configure for the common case — no mediation adapters, default options.
The geo-sharing controls are mirrored here (unlike every other option) because passive geo sharing is on by default and the opt-out should be visible at the simplest entry point. Anything else (mediation adapters, COPPA/TFUA flags, log level) is deliberately not mirrored — build an EloConfiguration and call
configure(context, configuration)instead.
-
configure
final static Unit configure(Context context, EloConfiguration configuration)
Configure the SDK.
Call this once, early in your app's lifecycle. Subsequent calls re-configure and reset the session ID; in-flight
loadAdcalls are unaffected. All options — including client-side mediation adapters — live on EloConfiguration; every field except EloConfiguration.elo has a sensible default.
-
setListener
final static Unit setListener(EloAdListener listener)
Register a listener for ad lifecycle callbacks. SDK holds it weakly.
-
setShareGeoLocation
final static Unit setShareGeoLocation(Boolean enabled)
Enable or disable Prebid-style passive geo sharing for future ad requests without reconfiguring the SDK.
When enabled, the SDK may attach an already-authorized last-known location as OpenRTB
device.geo. It never requests location permission itself — with no location permission granted, geo is simply omitted.Sharing is on by default since 0.1.8. This runtime toggle does not survive shutdown: a later configure restores the configuration's value (default on), so apps that opt out at runtime must opt out again after reconfiguring. Prefer
EloConfiguration.shareGeoLocation = falsefor a durable opt-out.
-
setUserIdentifier
final static Unit setUserIdentifier(String identifier)
Identify the signed-in user with your own stable identifier.
By default every ad request carries an anonymous, per-install
visitor_idthe SDK generates (anon_<UUID>). Setting an identifier replaces that value on all subsequent ad requests and tracking pings, so delivery, frequency capping, and reporting follow the account rather than the install.Elo.setUserIdentifier(account.id) // sign-in Elo.setUserIdentifier(null) // sign-outNotes:
Call it once the user is known, and pass
nullon sign-out. The order relative to configure does not matter. shutdown clears it; re-configuring does not, since a config refresh is not a sign-out.The anonymous id is kept in storage untouched underneath, so clearing the identifier restores the same
anon_<UUID>the install had before.It is persisted, encrypted at rest — one record with the user data, sealed with AES-GCM under an Android Keystore key. It survives a process restart, so you don't re-set it each launch. Requests made before you first set it use the anonymous id.
It survives a sign-out too, so clear it yourself when the user signs out — otherwise the next person on the device inherits it. Calling this from a single auth-state hook covers sign-in, sign-out, and a mid-session account switch in one place.
An ad keeps whichever identity it was requested under for its whole lifetime, so an impression firing after a sign-out is still reported against the request that fetched it.
Whitespace is trimmed; a blank string clears the identifier. Values longer than 256 characters (Unicode code points) are ignored with a warning.
Send an identifier your own systems use, not an email address or other directly identifying value — this id reaches Elo's ad server as the user's identity for targeting.
Mirrors iOS
Elo.setUserIdentifier.
-
setUserData
final static Unit setUserData(EloUserData userData)
Share what you know about the signed-in user with ad requests.
Age, gender, email, and phone ride along on every subsequent ad request as an optional
userobject. They are recorded for upcoming targeting features and have no effect on ad selection today. Nothing is sent when you never call this.Elo.setUserData(EloUserData(age = 34, gender = EloGender.FEMALE, email = account.email)) Elo.setUserData(null) // sign-outNotes:
Pass contact details as they are. They travel over HTTPS and are SHA-256 hashed at the ad server before anything is stored; do not hash them yourself.
The SDK does not validate what you set. The server normalizes each field and drops what it can't use. Give a phone number its country code (E.164) or the server discards it.
Each call replaces the whole object. Null clears it, as does an object with no field set.
Persisted, encrypted at rest (AES-GCM under an Android Keystore key), as one record with the identifier. It survives a sign-out, so clear it yourself when the user signs out, or the previous account's details keep riding requests on this device indefinitely. shutdown erases the stored copy; re-configuring does not.
Set it from the same auth-state hook as setUserIdentifier. The two are written as one record, and that hook is also what keeps a persisted copy from going stale when the user changes their email or phone.
Never joins tracking pings. The ad server discards it under COPPA, TFUA, or GDPR.
Transmitting an email and phone to Elo is a disclosure obligation — see
PRIVACY.md.
Mirrors iOS
Elo.setUserData.
-
setUserIdentity
final static Unit setUserIdentity(String userIdentifier, EloUserData userData)
Set both halves of the user's identity in one write.
Prefer this to calling setUserIdentifier and setUserData in sequence whenever both are changing — a sign-in, a sign-out, or an account switch. The two are persisted as one record, so two calls leave an intermediate state on disk: switching from account A to account B stores
(B, A's contact details)until the second call lands, and an ad request or a process kill in that window sends or retains one account's PII under the other's identifier. This overload has no such window.// sign-in / account switch Elo.setUserIdentity(account.id, account.eloUserData) // sign-out Elo.setUserIdentity(null, null)Each parameter behaves exactly as its single-field setter does, including the identifier's trimming and length rules: an identifier rejected for length leaves the stored one in place, and the user data is still applied.
Mirrors iOS
Elo.setUserIdentity.
-
setRequestPayloadCaptureEnabled
final static Unit setRequestPayloadCaptureEnabled(Boolean enabled)
Enable capture of each ad operation's redacted Elo request payload and decoded ad response into diagnostics (EloDiagnosticsEntry.requestPayloadJson and EloDiagnosticsEntry.responsePayloadJson).
Off by default. Message content is always dropped, but the captured request payload retains the advertising id, precise geolocation, consent strings, and any user data set via setUserData — including the plain email address and phone number — so privacy contracts stay inspectable. The captured response is the creative the server returned, re-encoded from what the SDK decoded. Enable it only in development/debug builds, and never log or transmit the captured payloads off the device.
This is a process-level switch: it is independent of configure and shutdown, so set it once (e.g. at app startup). Mirrors iOS
Elo.setRequestPayloadCaptureEnabled.
-
loadAd
@JvmOverloads() final static AdResult loadAd(List<ChatMessage> messages, List<ContextObject> contextObjects, AdDisplayPosition displayPosition)
Load an ad for the given chat context.
-
loadAd
@JvmOverloads() final static AdResult loadAd(List<ChatMessage> messages, List<ContextObject> contextObjects)
Load an ad for the given chat context.
-
loadAd
@JvmOverloads() final static AdResult loadAd(List<ChatMessage> messages)
Load an ad for the given chat context.
-
preloadAd
@JvmOverloads() final static Unit preloadAd(List<ChatMessage> messages, List<ContextObject> contextObjects, AdDisplayPosition displayPosition)
Warm the in-memory ad cache for the given chat context. Fire-and-forget.
-
preloadAd
@JvmOverloads() final static Unit preloadAd(List<ChatMessage> messages, List<ContextObject> contextObjects)
Warm the in-memory ad cache for the given chat context. Fire-and-forget.
-
preloadAd
@JvmOverloads() final static Unit preloadAd(List<ChatMessage> messages)
Warm the in-memory ad cache for the given chat context. Fire-and-forget.
-
trackRender
final static Unit trackRender(EloAd ad)
Manual render-time hook for fully-custom views.
At most one render is recorded per ad opportunity, so this is safe to call on every recomposition or view re-entry. A repeat load that returns the same creative is a new opportunity and does record again.
-
trackImpression
final static Unit trackImpression(EloAd ad)
Manual impression hook for fully-custom views.
At most one impression is recorded per ad opportunity, on the same terms as trackRender. A suppressed duplicate is silent: no ping, and no EloAdListener.onAdDidTrackImpression callback.
-
trackClick
final static Unit trackClick(EloAd ad)
Manual click hook for fully-custom views.
-
mediationDebugSnapshot
final static EloMediationDebugSnapshot mediationDebugSnapshot()
A read-only snapshot of adapter and auction state for debugging. Not a stable analytics pipeline. Phase 1 returns an empty snapshot.
-
diagnosticsSnapshot
final static EloDiagnosticsSnapshot diagnosticsSnapshot()
A read-only snapshot of integration health, recent ad operations, and recent tracking outcomes. Each operation's redacted Elo request payload is included only when setRequestPayloadCaptureEnabled has been turned on (off by default).
On-device inspection only — not a stable analytics pipeline; do not serialize its contents off the device. Mirrors iOS
Elo.Debug.snapshot().
-
shutdown
final static Unit shutdown()
Tear down the SDK. Cancels any in-flight
loadAdand clears state.
-
getSdkVersion
final static String getSdkVersion()
-
getIsDisabled
final static Boolean getIsDisabled()
-
-
-
-