简体   繁体   中英

GA4 and firebase: custom event firing twice in tablayout(android kotlin)

I logged event, and found out app actually give two event to firebase. those two event has same data, only ga_screen_id(on analytics debugview, firebase_screen_id) parameter is different. code is simiar,

fun setAnalyticsBanner(name: String, position: String){
    firebaseAnalytics.logEvent("banner") {
        param("os", OS)
        param("name", name)//for banner name
        param("position", position)
    }
}

and

fun setAnalyticsConnectionStart(type: String, value: String){
    firebaseAnalytics.logEvent("connection_start") {
        param("type", type)
        param("value", value)
        param("os", OS)
    }
}

I inserted these in button's onClick. only difference I can think is every event fired twice is linked with fragment wrapped in tablayout.

inside tabview screen:

first one: ga_screen_id(_si)=-4412416303248681103

second one: ga_screen_id(_si)=-4.412416303248681E18

screen without tabview:

first and only one: ga_screen_id(_si)=-4412416303248681096

I assume last 3 digit could be same and it is same number,one written in Int and other in Float, but why Float version only trigger in tablayout? how to fix it?

I know this is a bit old, but this is what I've discovered: some events like sign_up or login get duplicated for me, with the exact same behaviour you described (all attributes are the same except for attribute ga_screen_id that is different, for the data type).

The only thing I did was to rename those events, say, sign_up_ and login_ , and they magically stop showing up doubled in the debug view.

I suspect some bug in Firebase SDK for those events that might be somewhat special, but I couldn't find more information during my research. If I have time I might try to report it; need to create a minimal project and that takes time.

Hope this helps.

marketing team made duplecated event(same name) at console without knowing purpose of that. custom event is for made new event from exising one, not something you have to set to receive event from code.

"new event"'s trigger condition was just "when event I made triggered" so event with same name triggerd once each. hope it helps other people having similar issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM