Google Analytics SDK in your app

血红的双手。 提交于 2019-12-12 18:29:55

问题


I followed the instructions here:

https://developers.google.com/analytics/devguides/collection/android/v3/

And I implemented the analytics.xml file as:

<resources>
 <!--Replace placeholder ID with your tracking ID-->
 <string name="ga_trackingId">UA-XXXX-Y</string>

 <!--Enable automatic activity tracking-->
 <bool name="ga_autoActivityTracking">true</bool>

 <!--Enable automatic exception tracking-->
 <bool name="ga_reportUncaughtExceptions">true</bool>
</resources>

In the end it says "Important: Do not encode dashes in the ga_trackingId string. Doing so will prevent you from seeing any data in your reports."

Does that mean I should leave out the dashes and put something like UAXXXXY? In all other examples, I saw online, people used dashes? Clarification please


回答1:


No, it means that you can just leave it be like it looks.

<string name="ga_trackingId">UA-XXXX-Y</string>

The reminder is because Android Lint may prompt you to use encoded dashes instead of "-". You can simply ignore it.




回答2:


Your lint checker may warn you about the use of the figure dash ('-') in your tracking ID. You can suppress that warning by adding additional attributes to your tag.

Add this : <resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="TypographyDashes">

Hope this helps.



来源:https://stackoverflow.com/questions/19371183/google-analytics-sdk-in-your-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!