What are best practices for adding Google Analytics etc. for an App?
When it comes to Google Analytics, you may add the Google Analytics Tracking ID from Appfarm Create → Environments Config.
Info about this is found here. Once you add an ID (“UA-…”), the necessary scripts will be added to your apps, and page views will be automatically tracked. As with all client-side analytics, any ad-blockers or browser settings that prevent tracking may affect your reporting.
Note that this is only for Universal Analytics properties. Google Analytics 4 is not currently supported, but a challenge (change request) is registered on that.
If you want to log Events from your Apps (or custom Pageviews), you may use action node “Google Analytics Event” to send a specific Categories/Action (and optionally Labels or Values) to Google Analytics.
Note that if you encounter some errors refering to “content security policy” when running the script (e.g. refusing to connect to some external url), you might need to add a url hostname or two in the Content Security section of Environment Config.