Wrong documentation regarding multiple trackers

Jan 15, 2015 at 2:40 PM
I'd like to use two different trackers. To create different trackers the documentation says:
// Get tracker from singleton.
GoogleAnalytics gaInstance = GoogleAnalytics.Current;
Tracker tracker1 = gaInstance.GetTracker("UA-XXXX-Y"); // Placeholder property ID.
Tracker tracker2 = gaInstance.GetTracker("UA-XXXX-Y"); // Placeholder property ID.
But there is no "Current" Property in GoogleAnalytics. I found some other post that gave me a solution which could be right:
GoogleAnalytics gaInstance = AnalyticsEngine.Current;
Tracker tracker1 = gaInstance.GetTracker("UA-XXXX-Y"); // Placeholder property ID.
Tracker tracker2 = gaInstance.GetTracker("UA-XXXX-Y"); // Placeholder property ID.
The code looks fine, but I still get nothing sent to my GA console. Unfortunately the IsDebugEnabled-Flag does nothing to provide some debug output from the SDK (See the highest voted Issue: https://googleanalyticssdk.codeplex.com/workitem/15).

So since the documentation is wrong and the SDK gives no insight what going on during runtime, the only explanation that I can come up with is the analytics.xml: Since I create my trackers by code, I deleted the analytics.xml. Is this OK? If not: How do I use multiple analytics.xml files to use multiple trackers?

Hope someone can help me out. Until then I try to dig in the code and find out what's (not) going on.
Br,
Flo
Jan 19, 2015 at 9:12 AM
Okay, I found a solution. It seems that the main problem was the missing AppName and AppVersion. This is my code now:
public Tracker GetLocalTracker()
{
#if DEBUG
            var tracker = AnalyticsEngine.Current.GetTracker(LocalTrackingIdTesting);
#else
            var tracker = AnalyticsEngine.Current.GetTracker(LocalTrackingId);
#endif
            tracker.AppName = AppName;
            tracker.AppVersion = AppVersion;
            return tracker;
}
I also have a method named GetGlobalTracker which returns another tracker. The switch between the trackers works fine now and everything gets delivered to Google correctly.