简体   繁体   中英

Google Analytics SDK for Android v2

I want to include Google Analytics in my android application, but I'm unable to see events in google analytic page. Here is my code:

analytic.xml:

<resources xmlns:tools="https://schemas.android.com/tools"
           tools:ignore="TypographyDashes">
    <string name="ga_trackingId">UA-00000000-0</string>
    <bool name="ga_autoActivityTracking">true</bool>
    <bool name="ga_reportUncaughtExceptions">true</bool>
    <string name="ga_sampleFrequency">50.0</string> </resources>

java code:

first version:

 Tracker tracker = GoogleAnalytics.getInstance(context).getDefaultTracker();
 tracker.sendEvent(category, action, label, value);

second version:

GoogleAnalytics.getInstance(context).getTracker("UA-00000000-0").sendEvent(category, action, label, value);

but none of these works (I see in analytics page that screens are viewed, but I don't see any events in Engagemend->Events->Overview). Am I doing something wrong? I have a tracking id.

What are the differences between those two version of code?

知道了:发送事件后,我必须致电

GAServiceManager.getInstance().dispatch();

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