iOS SDK 

  1. Download OWOX BI Streaming plugin for iOS applications: OBIStreaming.zip.
  2. Add OBIStreaming.framework library to your iOS application.
  3. Import the library in AppDelegate.m:
    #import <OBIStreaming/OBIStreaming.h>
  4. Initialize streaming and define your Google Analytics web-property ID:
    — (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
      [[OBIStreaming sharedInstance] setTrackerIds:[NSSet setWithArray:@[@"UA-XXXX-X"]]];
    }
  5. Session data requires you to define session scope custom dimension where you collect session ID.

    Here is a snippet for applications using iOS Google Analytics Services SDK to set up session ID data collection. Copy it and replace XX with custom dimension number.

    - (NSString *)hitIdWithClientIdentifier:(NSString *)clientId {
        if ([clientId length] == 0) {
            return nil;
        }
        NSTimeInterval timeInterval = [[NSDate date] timeIntervalSince1970];
        return [NSString stringWithFormat:@"%@_%.0f", clientId, timeInterval * 1000];
    }
    NSString *client_id = [[[GAI sharedInstance] trackerWithTrackingId:@"UA-XXXX-X"] get:kGAIClientId];
    [tracker send:[[[GAIDictionaryBuilder createScreenView] set:[self hitIdWithClientIdentifier:client_id]
                                                         forKey:[GAIFields customDimensionForIndex:XX]] build]];
  6. Verify that Google Analytics hits are additionally sent to google-analytics.bi.owox.com domain and contain &cdXX parameter with values.

GTM

  1. Download OWOX BI Streaming plugin for iOS applications: OBIStreaming.zip.
  2. Add OBIStreaming.framework library to your iOS application.
  3. Import the library in AppDelegate.m:
    #import <OBIStreaming/OBIStreaming.h>
  4. Initialize streaming and define your Google Analytics web-property ID:
    — (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
      [[OBIStreaming sharedInstance] setTrackerIds:[NSSet setWithArray:@[@"UA-XXXX-X"]]];
    }
  5. Session data requires you to define session scope custom dimension where you collect session ID.

    Here is a snippet for applications using iOS Google Tag Manager SDK to set up GTM Function Call variable with session ID:

    #import "OBIStreamingGTMHitIdFunctionCallMacroHandler.h"
    
    - (void)containerAvailable:(TAGContainer *)container {
        // Important note: containerAvailable may be called from a different thread, marshall the
        // notification back to the main thread to avoid a race condition with viewDidAppear.
        dispatch_async(dispatch_get_main_queue(), ^{
            self.container = container;
            // Register a function call macro handler using the macro name defined
            // in the Google Tag Manager web interface.
            [self.container registerFunctionCallMacroHandler:[[OBIStreamingGTMHitIdFunctionCallMacroHandler alloc] init] forMacro:kOBIStreamingGTMMacroFunctionHitId];
        });
    }

    Import required library:

    You need to collect session ID custom dimension data from this variable in every Google Analytics tag fired in your application.

  6. Verify that Google Analytics hits are additionally sent to google-analytics.bi.owox.com domain and contain session ID custom dimension with values.

Google Firebase

You can also use Google Firebase for data collection from your iOS app in Google BigQuery in real time.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.