Login With User Properties
A login event example with Firebase user_properties for Android and iOS.
DataLayer Example
- Android Firebase (Kotlin)
- Android Firebase (Java)
- iOS Firebase (Swift)
- iOS Firebase (Obj-C)
firebaseAnalytics.setUserProperty(FirebaseAnalytics.UserProperty.SIGN_UP_METHOD, "email")
firebaseAnalytics.setUserProperty(FirebaseAnalytics.UserProperty.ALLOW_AD_PERSONALIZATION_SIGNALS, "false")
firebaseAnalytics.logEvent(FirebaseAnalytics.Event.LOGIN) {
param(FirebaseAnalytics.Param.METHOD, "email")
}
mFirebaseAnalytics.setUserProperty(FirebaseAnalytics.UserProperty.SIGN_UP_METHOD, "email");
mFirebaseAnalytics.setUserProperty(FirebaseAnalytics.UserProperty.ALLOW_AD_PERSONALIZATION_SIGNALS, "false");
Bundle eventParams = new Bundle();
eventParams.putString(FirebaseAnalytics.Param.METHOD, "email");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.LOGIN, eventParams);
Analytics.setUserProperty("email", forName: AnalyticsUserPropertySignUpMethod)
Analytics.setUserProperty("false", forName: AnalyticsUserPropertyAllowAdPersonalizationSignals)
var eventParams: [String: Any] = [
AnalyticsParameterMethod: "email"
]
Analytics.logEvent(AnalyticsEventLogin, parameters: eventParams)
[FIRAnalytics setUserPropertyString:@"email" forName:kFIRUserPropertySignUpMethod];
[FIRAnalytics setUserPropertyString:@"false" forName:kFIRUserPropertyAllowAdPersonalizationSignals];
NSMutableDictionary *eventParams = [@{
kFIRParameterMethod: @"email"
} mutableCopy];
[FIRAnalytics logEventWithName:kFIREventLogin parameters:eventParams];
Event Properties
| Property | Type | Constraints | Examples | Description |
|---|---|---|---|---|
| $schema | string | required | | Defines the structure of the event. |
const: "https://tracking-docs-demo.buchert.digital/schemas/1.3.0/mobile/login-with-user-properties-event.json" | ||||
| event | string | required | | The event name for user login. |
const: "login" | ||||
| method | string | required | | Login method. |
| {}user_properties | object | required | Firebase user properties to set before logging the event. | |
| sign_up_method | string | required | | The sign up method user property. |
| allow_ad_personalization_signals | string, null | | Whether ad personalization signals are allowed. | |
additionalPropertiesSchema constraintControls properties not listed in properties and not matched by patternProperties. | string, null | | Additional Firebase user property values keyed by property name. | |
patternProperties/^custom_/Schema constraintApplies the subschema to property names that match the given regular expression. | string, null | | Custom Firebase user properties for keys prefixed with custom_. |
View Raw JSON Schema
{
: "https://json-schema.org/draft/2020-12/schema",
: "https://tracking-docs-demo.buchert.digital/schemas/1.3.0/mobile/login-with-user-properties-event.json",
"title": "Login With User Properties",
"description": "A login event example with Firebase user_properties for Android and iOS.",
"x-tracking-targets": [
"android-firebase-kotlin-sdk",
"android-firebase-java-sdk",
"ios-firebase-swift-sdk",
"ios-firebase-objc-sdk"
],
"type": "object",
"properties": {
"$schema": {
"type": "string",
"description": "Defines the structure of the event.",
"const": "https://tracking-docs-demo.buchert.digital/schemas/1.3.0/mobile/login-with-user-properties-event.json"
},
"event": {
"type": "string",
"const": "login",
"description": "The event name for user login."
},
"method": {
"type": "string",
"description": "Login method.",
"examples": [
"email"
]
},
"user_properties": {
"type": "object",
"description": "Firebase user properties to set before logging the event.",
"properties": {
"sign_up_method": {
"type": "string",
"description": "The sign up method user property.",
"examples": [
"email"
]
},
"allow_ad_personalization_signals": {
"type": [
"string",
"null"
],
"description": "Whether ad personalization signals are allowed.",
"examples": [
"false",
null
]
}
},
"additionalProperties": {
"type": [
"string",
"null"
],
"description": "Additional Firebase user property values keyed by property name.",
"examples": [
"beta_tester",
null
]
},
"patternProperties": {
"^custom_": {
"type": [
"string",
"null"
],
"description": "Custom Firebase user properties for keys prefixed with custom_.",
"examples": [
"vip_member",
null
]
}
},
"required": [
"sign_up_method"
]
}
},
"required": [
"$schema",
"event",
"method",
"user_properties"
]
}