azure-application-insightsvisual-studio-app-center

Filter out App Center analytics by IP address


We are currently using Microsoft App Center Analytics for our Xamarin Forms app (IOS and Android). We will be pulling the analytics data through Azure Application Insights as well.

We would like to remove or filter out the analytics events from out Test and Development devices. Are there any recommended approaches for doing this? Is there something built into App Center that we should be taking advantage of?

We could do something simple and blunt that just swallow calls to Analytics.TrackEvent when it is a DEBUG build but that doesn't cover Test devices that would be running in release mode.


Solution

  • I know I'm late for the party. My problem was to ignore the local traffic (dev testers and QA testers) and capture only the external usage (customers) of the app.

    My solution was to give two different builds, one for QA and another for production.

    Step 1: Register 2 apps on the app center and obtain 2 app secrets

    Step 2: Create two build configurations in VS 2022. I have created "Internal_QA_Release" and "Release" configurations. enter image description here

    Step 3: Do a code change to switch the app center initialization via C# "preprocessor directives".

        #if INTERNAL_QA_RELEASE
                    AppCenter.Start("a8218b7ae74f5a9",
                               typeof(Analytics), typeof(Crashes));
        #endif
    
        #if RELEASE
                        AppCenter.Start("94646a-3f7c1bc2b88f",
                           typeof(Analytics), typeof(Crashes));
        #endif
    

    Step 4: Finally do the internal releases by switching to "Internal_QA_Release" solution configuration and for production use the "Release" solution configuration.