问题
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