如何跟踪和分析Android应用程序?

发布于 2024-09-02 11:39:39 字数 1436 浏览 7 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

何时共饮酒 2024-09-09 11:39:39

您可以使用 FlurryGoogle Analytics 来收集其中一些数据(不确定设备 ID 或 IP 地址),但正如其他人所说,您可能出于隐私考虑,希望通过应用程序首选项进行此“选择加入”。

You can use a service like Flurry or Google Analytics to gather some of this data (not sure about device ID or IP address), but as others have said, you might want to make this "opt-in" via an application preference due to privacy concerns.

云巢 2024-09-09 11:39:39

您可以通过以编程方式在应用程序中读取此信息,然后通过短信、电子邮件将其发送给您,或者只是将其上传到服务器来相对轻松地完成此操作。

然而,我不认为用户会因为你这样做而感到非常幸运。至少你必须告知他们这一点。

对于 ID,您可以使用以下内容:

http:// developer.android.com/reference/android/telephony/TelephonyManager.html#getDeviceId%28%29

要获取 IP,您可以使用以下代码:

public String getLocalIpAddress() {
    try {
        for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
            NetworkInterface intf = en.nextElement();
            for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
                InetAddress inetAddress = enumIpAddr.nextElement();
                if (!inetAddress.isLoopbackAddress()) {
                    return inetAddress.getHostAddress().toString();
                }
            }
        }
    } catch (SocketException ex) {
        Log.e(LOG_TAG, ex.toString());
    }
    return null;
}

获取网络类型(我认为您谈论的是 wifi 或移动)您可以使用此代码片段:

ConnectivityManager conMan = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);

//mobile
State mobile = conMan.getNetworkInfo(0).getState();

//wifi
State wifi = conMan.getNetworkInfo(1).getState();

然后像这样使用它:

if (mobile == NetworkInfo.State.CONNECTED || mobile == NetworkInfo.State.CONNECTING) {
    //mobile
} else if (wifi == NetworkInfo.State.CONNECTED || wifi == NetworkInfo.State.CONNECTING) {
    //wifi
}

You could do this relatively easy by reading this information in your app programatically and then send it to you per sms, email, or just upload it to a server.

However, I don't think that the users will be very lucky that you're doing this. At least you have to inform them about that.

For a ID you could use this:

http://developer.android.com/reference/android/telephony/TelephonyManager.html#getDeviceId%28%29

To get the IP you could use this code:

public String getLocalIpAddress() {
    try {
        for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
            NetworkInterface intf = en.nextElement();
            for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
                InetAddress inetAddress = enumIpAddr.nextElement();
                if (!inetAddress.isLoopbackAddress()) {
                    return inetAddress.getHostAddress().toString();
                }
            }
        }
    } catch (SocketException ex) {
        Log.e(LOG_TAG, ex.toString());
    }
    return null;
}

To get the network type (I think your talking about wifi or mobile) you can use this code snippet:

ConnectivityManager conMan = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);

//mobile
State mobile = conMan.getNetworkInfo(0).getState();

//wifi
State wifi = conMan.getNetworkInfo(1).getState();

and then use it like that:

if (mobile == NetworkInfo.State.CONNECTED || mobile == NetworkInfo.State.CONNECTING) {
    //mobile
} else if (wifi == NetworkInfo.State.CONNECTED || wifi == NetworkInfo.State.CONNECTING) {
    //wifi
}
狠疯拽 2024-09-09 11:39:39

您不需要推出自己的解决方案,有很多免费的现成解决方案可以工作,让您专注于您的应用程序。我还建议远离网络分析解决方案,因为应用程序模型不同,因此将移动应用程序硬塞进去可能会很奇怪。您不认为您的应用程序是页面浏览量和推荐,是吗?

Localytics 是一种解决方案:该服务是免费的,SDK 是开源的,并且周转时间是即时的,因此可以在 10 分钟内完成集成和验证。

[免责声明:这是我的网站]

You don't need to roll your own solution, there are plenty of free, off-the-shelf solutions which work and will let you focus on your app. I also recommend staying away from web analytics solutions because the application model is different so shoe-horning a mobile app into it can be strange. You don't think of your app as page views and referrals, do you?

Localytics is one solution: the service is free, the SDK is open source, and the turnaround time is instant so integration can be done and verified in 10 minutes.

[Disclaimer: this is my site]

霞映澄塘 2024-09-09 11:39:39

Google 为此提供了完整的 SDK。文档和详细信息可在以下位置获取:
http://code.google.com/mobile/analytics/docs/android/< /a>

从页面:

移动应用的 Google Analytics(分析)
SDK提供了用于跟踪的接口
移动应用程序中的活动以及
通过报告该活动
标准 Google Analytics 仪表板。

跟踪移动应用程序有一些
跟踪的结构变化
网站页面。出于这个原因,你
应该熟悉分析
跟踪以了解如何
这个 SDK 可以工作。

使用SDK跟踪两种基本类型
用户交互:

综合浏览量 - 这是标准单位
测量传统网站,
并用于计算访问量,
会话长度和跳出率。我们
建议您至少触发
应用程序加载时的一次页面浏览量
跟踪唯一访客。因为移动
应用程序不包含 HTML 页面,您
必须决定何时(以及多久)
触发浏览量请求,然后选择
报告的描述性名称
目的。您选择的名称将是
在您的分析报告中填充为
内容报告中的页面路径,
即使它们实际上不是 HTML
页。

事件 - 您可以定义其他
事件中要报告的事件
Google Analytics 的跟踪部分。
事件按类别分组
并且还可以使用每个事件的标签,
这提供了灵活性
报告。例如,多媒体
应用程序可以播放/停止/暂停
其视频类别的操作以及
为每个视频名称分配一个标签。
谷歌分析报告将
然后聚合所有事件的事件
标记有视频类别。为了
有关事件跟踪的更多信息,
请参阅事件跟踪指南

Google has a full SDK for this very purpose. Documentation and details are available at:
http://code.google.com/mobile/analytics/docs/android/

From the page:

The Google Analytics for Mobile Apps
SDKs provide an interface for tracking
activity within mobile apps and
reporting that activity via the
standard Google Analytics dashboard.

Tracking mobile applications has some
structural variations from tracking
website pages. For that reason, you
should be familiar with Analytics
tracking in order to understand how
this SDK works.

Use the SDK to track two basic types
of user interaction:

Pageviews - This is the standard unit of
measure for a traditional web site,
and is used to calculate visits,
session length, and bounce rate. We
recommend that you trigger at least
one pageview at application load to
track unique visitors. Because mobile
apps don't contain HTML pages, you
must decide when (and how often) to
trigger a pageview request, and choose
descriptive names for reporting
purposes. The names you choose will be
populated in your Analytics reports as
page paths in the Content reports,
even though they are not actually HTML
pages.

Events - You can define additional
events to be reported in the Event
Tracking section of Google Analytics.
Events are grouped using categories
and may also use per-event labels,
which provides flexibility in
reporting. For example, a multimedia
app could could have play/stop/pause
actions for its video category and
assign a label for each video name.
The Google Analytics reports would
then aggregate events for all events
tagged with the video category. For
more information on Event Tracking,
see the Event Tracking Guide

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文