简体   繁体   English

如何在混合移动应用程序中实施 Google Analytics?

[英]How to implement Google Analytics in hybrid mobile apps?

I am writing a hybrid mobile app using HTML5, CSS and jQuery Mobile.我正在使用 HTML5、CSS 和 jQuery Mobile 编写一个混合移动应用程序。 I will use Cordova Js to convert the HTML5 app to native mobile apps for iOS and Android.我将使用 Cordova Js 将 HTML5 应用程序转换为适用于 iOS 和 Android 的本机移动应用程序。 I want to use Google Analytics to track various activities performed by users.我想使用 Google Analytics 来跟踪用户执行的各种活动。 I found that GA provides SDKs for native apps but not much was specified for hybrid apps.我发现 GA 为原生应用程序提供了 SDK,但没有为混合应用程序指定太多。 Have you implemented tracking for Cordova or PhoneGap based apps?您是否为基于 Cordova 或 PhoneGap 的应用程序实施了跟踪? Can you provide me some direction on how to do it?你能给我一些关于如何去做的指导吗?

I use the ngCordova Google Analytics plugin.我使用 ngCordova 谷歌分析插件。 You don't need Angular or Cordova to use it http://ngcordova.com/docs/plugins/你不需要 Angular 或 Cordova 来使用它http://ngcordova.com/docs/plugins/

The git and docs are here: https://github.com/danwilson/google-analytics-plugin git 和文档在这里: https : //github.com/danwilson/google-analytics-plugin

Easy to use.便于使用。

Warning!警告! When you set it all up leave it 24hrs to 'propagate' or whatever Google does.当你把它全部设置好时,让它 24 小时“传播”或谷歌所做的任何事情。 People find its not working and go searching for solutions (which cannot be found) and then BAM the next day its all good.人们发现它不起作用并去寻找解决方案(无法找到),然后第二天 BAM 一切都很好。

First, in 2019 and later you probably want to use Firebase for mobile app analytics.首先,在 2019 年及以后,您可能希望使用 Firebase 进行移动应用分析。

Google it.去谷歌上查询。

Second, no matter what you decided to use, Firebase or Analytics, you can其次,无论您决定使用 Firebase 还是 Analytics,您都可以

1) use plugin (there some of them for both Firebase and Analytics) 1) 使用插件(其中一些用于 Firebase 和 Analytics)

2) just include relative script in your index.html same way you do in web app. 2) 只需在您的 index.html 中包含相关脚本,就像您在 Web 应用程序中所做的那样。 In this case in Analytics console you should create 3 different apps (one for each platform), that you can be able to separate user activity on iPhone from Android and Web.在这种情况下,您应该在 Analytics 控制台中创建 3 个不同的应用程序(每个平台一个),您可以将 iPhone 上的用户活动与 Android 和 Web 分开。

You can create a plugin to bridge between your JS and Native GA SDK.您可以创建一个插件来在您的 JS 和 Native GA SDK 之间架起桥梁。 There are some already written plugins for your reference有一些已经写好的插件供大家参考

https://github.com/danwilson/google-analytics-plugin https://github.com/danwilson/google-analytics-plugin

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从商店下载时如何在混合移动应用程序中实施推荐代码 - How to implement referral code in Hybrid Mobile Apps while downloading from store 混合移动应用中的图像处理 - Image manipulation in hybrid mobile apps 混合移动应用程序的API调用 - API calls for Hybrid Mobile Apps 在Hybrid Cordova应用程序中实现指纹读取功能 - Implement Fingerprint reading functionality in Hybrid Cordova apps 混合移动应用是否支持推送通知? - Do hybrid mobile apps support Push Notifications? 我应该如何针对混合移动应用程序执行平台特定的代码管理(SVN)? - How should I do the platform specific code managements(SVN) for hybrid mobile apps? Google Maps在混合移动应用程序中缓存切片 - Google Maps caching tiles in hybrid mobile application 如何使用Google Map JavaScript API在混合移动应用程序中的高密度Android设备中缩放Google Map? - How to zoom google map in high density android devices in hybrid mobile app using google map javascript API? 在适用于Windows / Android,iOS的多设备混合应用程序上实现sqlite - implement sqlite on multi-device hybrid apps for windows / android,ios 在混合移动应用程序中,localStorage是保存授权令牌的首选位置吗? - Is localStorage preferred place to save Authorization token in hybrid mobile apps?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM