[英]Google Analytics Version 3 for Android - Nothing is logged or tracked
WHAT I NEED 我需要的
My analytics screen is empty. 我的分析屏幕为空。 0 users, 0 sessions, etc. I have waited for a couple hours for some kind of tracking to show up but no luck.
0个用户,0个会话,等等。我已经等了几个小时才出现某种跟踪,但是没有运气。 Is there any way that events are logged on LogCat?
有什么方法可以在LogCat上记录事件? How do I have any kind of indication that something is happening?
我怎么有迹象表明发生了什么? I am currently running on debug mode, so any kind of indication would be great!
我目前正在调试模式下运行,因此任何指示都很好! I have waited for 4 hours.
我已经等了四个小时了。
WHAT I DID SO FAR 我做了什么
@Override
public void onStart() {
super.onStart();
// The rest of your onStart() code.
EasyTracker.getInstance(this).activityStart(this); // Add this method.
GoogleAnalytics.getInstance(this).getLogger()
.setLogLevel(Logger.LogLevel.VERBOSE);
GoogleAnalytics googleAnalytics = GoogleAnalytics.getInstance(getApplicationContext());
googleAnalytics.setAppOptOut(false);
}
@Override
public void onStop() {
super.onStop();
// The rest of your onStop() code.
EasyTracker.getInstance(this).activityStop(this); // Add this method.
}
SAMPLE CODE THAT LOGS EVENT : 记录事件的示例代码:
public void toggleMenuVisibility() {
EasyTracker easyTracker = EasyTracker.getInstance(this);
easyTracker.set(Fields.SCREEN_NAME, "screen_name");
easyTracker.send(MapBuilder.createAppView().build());
// MapBuilder.createEvent().build() returns a Map of event fields and values
// that are set and sent with the hit.
easyTracker.send(MapBuilder
.createEvent("ui_action", // Event category (required)
"button_press", // Event action (required)
"menu_button", // Event label
null) // Event value
.build()
);
Tracker tracker = GoogleAnalytics.getInstance(this).getTracker("UA-XXXXXXXX-X"); <!-- Property ID omitted for security -->
HashMap<String, String> hitParameters = new HashMap<String, String>();
hitParameters.put(Fields.HIT_TYPE, "appview");
hitParameters.put(Fields.SCREEN_NAME, "Home Screen");
tracker.send(hitParameters); }
XML: XML:
<!--Replace placeholder ID with your tracking ID--> <string name="ga_trackingId">UA-XXXXXXXX-X</string> <!-- Property ID omitted for security --> <!--Enable automatic activity tracking--> <bool name="ga_autoActivityTracking">true</bool> <!--Enable automatic exception tracking--> <bool name="ga_reportUncaughtExceptions">true</bool> <bool name="ga_debug">true</bool> <integer name="ga_dispatchPeriod">3</integer>
All that my log shows : 我的所有日志显示:
03-24 16:23:37.884 25140-8258/? W/GA-SERVICE﹕ Thread[Thread-5164,5,main]: Using destination https://ssl.google-analytics.com
03-24 16:23:37.904 25140-8258/? W/GA-SERVICE﹕ Thread[Thread-5164,5,main]: Using destination https://ssl.google-analytics.com
03-24 16:21:56.884 8137-8193/com.klinify I/GAV3﹕Thread[GAThread,5,main]: No campaign data found.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.