AlexVPerl
AlexVPerl

Reputation: 8006

Android Java or Kotlin example for sending Custom Events & Parameters to Google Analytics 4

Looking for most recent Google Analytics 4 for Android custom Events implementation / example / instructions. Specifically looking for:

I'm not looking for old Firebase events as this is now part of GA4 - its different now.

Google's help for this shows a video with web examples that are not applicable to Android directly.

So, a recent implementation or code sample would be very helpful.

Upvotes: 0

Views: 932

Answers (1)

Game Programmer
Game Programmer

Reputation: 44

Here is a link to Google's official documentation on sending custom events with custom parameters in Google Analytics 4 for Android:

https://developers.google.com/analytics/devguides/collection/android/v4/events

Here is an example of code for sending custom events with custom parameters in Google Analytics 4 for Android using Java:

// Get the tracker.
Tracker tracker = getDefaultTracker();

// Build and send the custom event.
tracker.send(
    new HitBuilders.EventBuilder()
        .setCategory("Video")
        .setAction("Play")
        .setLabel("Trailer")
        .setValue(1)

Upvotes: 0

Related Questions