kalnyc67 / analytics-issues

Automatically exported from code.google.com/p/analytics-issues
0 stars 0 forks source link

iOS SDK 3.10: Manual screen tracking doesn't work (iOS 8, Swift) #595

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I am using Google Analytics iOS SDK 3.10, on an app built with Swift for iOS 
8.1.  

I can see in verbose mode that manual screen views are being generated, but no 
data is being sent to the Google Analytics console.  Event tracking is working 
just fine.  Here's what the console shows:

(GAIBatchingDispatcher.m:497): Saved hit: {
    parameters =     {
        "&_crc" = 0;
        "&_u" = ".enqroKK-L";
        "&_v" = "mi3.1.0";
        "&a" = 778891005;
        "&aid" = "com.sample.MyApp";
        "&an" = MyApp;
        "&av" = "1.0";
        "&cd1" = "iPhone 5s";
        "&cid" = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx";
        "&ds" = app;
        "&sr" = 320x568;
        "&t" = screenview;
        "&tid" = "UA-xxxxxxxx-1";
        "&ul" = en;
        "&v" = 1;
        "&z" = 15782425432915297150;
        gaiVersion = "3.10";
        screenview = "MyApp ViewController";
    };
    timestamp = "2015-03-20 19:32:21 +0000";

I've initialized GA properly, and am sending a screen view in ViewWillAppear 
using this code:

    class func screenView(screen: String) {
        let tracker = GAI.sharedInstance().defaultTracker
        tracker.set(kGAIScreenView, value: screen)
        tracker.set(GAIFields.customDimensionForIndex(1), value: Analytics.deviceName())
        let screenDict = GAIDictionaryBuilder.createAppView().build()
        tracker.send(screenDict)
    }

If I change my UIViewController to inherit from GAITrackedViewController 
instead and use automatic screen recording, then screen views are being 
recorded properly.

Original issue reported on code.google.com by erichgra...@gmail.com on 20 Mar 2015 at 8:01

GoogleCodeExporter commented 9 years ago
Take a look here: 
http://stackoverflow.com/questions/29546605/issue-with-google-analytics-in-swift
-1-2

Original comment by math...@lodgem.com on 22 Apr 2015 at 5:38