Skip to main content
Version: 1.3.0

Custom Event

A custom Firebase event example for mobile apps.

DataLayer Example

firebaseAnalytics.logEvent("my_custom_event") {
param("custom_prop", "gold_user")
param("custom_value", 42.5)
param("custom_flag", 1L)
param("country", "DE")
param("status_code", "500")
param("region_bucket", "public-west")
param("sku", "SKU-12345")
}

Event Properties

PropertyTypeConstraintsExamplesDescription
$schemastringrequired
"https://tracking-docs-demo.buchert.digital/schemas/1.3.0/mobile/custom-event.json"
Defines the structure of the event.
const: "https://tracking-docs-demo.buchert.digital/schemas/1.3.0/mobile/custom-event.json"
eventstringrequired
"my_custom_event"
Custom event name.
custom_propstring
"gold_user"
An example custom event parameter.
custom_valuenumber
42.5
An example numeric custom event parameter.
custom_flagboolean
true
An example boolean custom event parameter.
countrystringnot: { const: "US" }
"DE"
Country code that must not be US (demo for not + const rendering).
status_codestringnot: { anyOf: [{ const: "200" }, { pattern: "^2[0-9]{2}$" }, { enum: ["ok", "success"] }] }
"500"
Complex not example: disallow success-like codes via nested anyOf.
region_bucketstringnot: { anyOf: [{ pattern: "^internal-" }, { enum: ["private", "secret"] }, { allOf: [{ minLength: 2 }, { maxLength: 2 }, { pattern: "^[A-Z]{2}$" }] }] }
"public-west"
Complex not example: disallow restricted prefixes and exact values.
skustringnot: { anyOf: [{ pattern: "^[0-9]{1,4}$" }, { enum: ["unknown", "tbd", "na"] }, { allOf: [{ pattern: "^[A-Z0-9_-]+$" }, { maxLength: 3 }] }] }
"SKU-12345"
Complex not example: disallow short numeric-only IDs and known placeholders.
additionalPropertiesSchema constraintControls properties not listed in properties and not matched by patternProperties.string, number, integer, boolean, null
View Raw JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tracking-docs-demo.buchert.digital/schemas/1.3.0/mobile/custom-event.json",
  "title": "Custom Event",
  "description": "A custom Firebase event example for mobile apps.",
  "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/custom-event.json"
    },
    "event": {
      "type": "string",
      "description": "Custom event name.",
      "examples": [
        "my_custom_event"
      ]
    },
    "custom_prop": {
      "type": "string",
      "description": "An example custom event parameter.",
      "examples": [
        "gold_user"
      ]
    },
    "custom_value": {
      "type": "number",
      "description": "An example numeric custom event parameter.",
      "examples": [
        42.5
      ]
    },
    "custom_flag": {
      "type": "boolean",
      "description": "An example boolean custom event parameter.",
      "examples": [
        true
      ]
    },
    "country": {
      "type": "string",
      "description": "Country code that must not be US (demo for not + const rendering).",
      "not": {
        "const": "US"
      },
      "examples": [
        "DE"
      ]
    },
    "status_code": {
      "type": "string",
      "description": "Complex not example: disallow success-like codes via nested anyOf.",
      "not": {
        "anyOf": [
          {
            "const": "200"
          },
          {
            "pattern": "^2[0-9]{2}$"
          },
          {
            "enum": [
              "ok",
              "success"
            ]
          }
        ]
      },
      "examples": [
        "500"
      ]
    },
    "region_bucket": {
      "type": "string",
      "description": "Complex not example: disallow restricted prefixes and exact values.",
      "not": {
        "anyOf": [
          {
            "pattern": "^internal-"
          },
          {
            "enum": [
              "private",
              "secret"
            ]
          },
          {
            "allOf": [
              {
                "minLength": 2
              },
              {
                "maxLength": 2
              },
              {
                "pattern": "^[A-Z]{2}$"
              }
            ]
          }
        ]
      },
      "examples": [
        "public-west"
      ]
    },
    "sku": {
      "type": "string",
      "description": "Complex not example: disallow short numeric-only IDs and known placeholders.",
      "not": {
        "anyOf": [
          {
            "pattern": "^[0-9]{1,4}$"
          },
          {
            "enum": [
              "unknown",
              "tbd",
              "na"
            ]
          },
          {
            "allOf": [
              {
                "pattern": "^[A-Z0-9_-]+$"
              },
              {
                "maxLength": 3
              }
            ]
          }
        ]
      },
      "examples": [
        "SKU-12345"
      ]
    }
  },
  "required": [
    "$schema",
    "event"
  ],
  "allOf": [
    {
      "$ref": "https://tracking-docs-demo.buchert.digital/constraints/schemas/firebase/v1/flat-event-params.json"
    }
  ]
}