11

I decided to use Google Analytics over Flurry, as Flurry stopped updating tracking Events and nobody from Flurry Support team replied to my query. My requirement is as follows:

  • "Whenever user clicks on tab I need to create an event which includes Tab Name, User ID, Time Stamp." A screenshot from Flurry Event log may describe it more clearly.

Flurry Event Log

So, in Google Analytics Event Tracking function createEventWithCategory almost does the needful but it does not allow me to add my custom parameters like User ID, Time Stamp.

[tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"ui_action"     // Event category (required)
                                                  action:@"button_press"  // Event action (required)
                                                   label:@"play"          // Event label
                                                   value:nil] build]];    // Event value

I tried for two solutions and neither of them are upto my expectation which brings me with two questions regarding each approach I took:

Attempt 1: Custom Dimensions:

Documentation has a sample code like this :

// Set the custom dimension value on the tracker using its index.

 tracker set:[GAIFields customDimensionForIndex:1]value:@"Premium user"]
[tracker set:kGAIScreenName value:@"Home screen"];

// Send the custom dimension value with a screen view.
// Note that the value only needs to be sent once, so it is set on the Map,
// not the tracker.

 [tracker send:[[[GAIDictionaryBuilder createAppView] set:@"premium"
                                              forKey:[GAIFields customDimensionForIndex:1]] build]];

[Custom dimension values can be sent with any Google Analytics hit type, including screen views, events, ecommerce transactions, user timings, and social interactions.]

So, I decided to use custom dimensions with createEventWithCategory method and ended up doing like as follows **which works but does not show data as Flurry showed. **

 NSString *dimensionValue = @"USER_ID";
[tracker set:[GAIFields customDimensionForIndex:1] value:dimensionValue];
[tracker send:[[[GAIDictionaryBuilder createEventWithCategory:@"TAB_CLICK"
                                                           action:@"Tab Hit"
                                                            label:clickedTabName
                                                            value:nil]
              set:currentUserEmail forKey:[GAIFields customDimensionForIndex:1]] build]];

GA Custom Dimension


Attempt 2: Setting and Sending Data using Dictionaries:

I followed the documentation and tried sending NSDictionary object to - (void)send:(NSDictionary *)parameters;method declared in GAITracker.h.

But I have no clue where this data will appear in dashboard. Neither in Behavior not in Real Time it shows any update.

 id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"UA-XXXX-X"]; 
 NSDictionary *dataToSendGoogleAnalytics = [NSDictionary dictionaryWithObjectsAndKeys:currentTime,@"TIME_STAMP",clickedTabName,@"TAB_NAME", currentUserEmail, @"USER_ID",nil];   
 [tracker send:dataToSendGoogleAnalytics];

Question: Can't I use something straightforward as Flurry which will give me result like in image and allow me to have event parameters like USER_EMAIL, Time_Stamp, TAB_NAME altogether with every event?:

Flurry Event

Using simple function like this which accepts NSDictionary object?

[Flurry logEvent:@"TAB_CLICKED" withParameters:dataToSendFlurry timed:YES];

Any suggestions or hint would be appreciated. Thank you.

10
  • Couldn't you pass USER_EMAIL (which isn't allowed within GA), Time_stamp, and TAB_NAME, within the same Custom Dimension? Commented Jun 19, 2014 at 19:05
  • 1) Yes. I read the guideline and I am removing characters after @ in user email. 2) I'm sending all parameters using custom dimensions with different index. But doing that won't get me all dimensions altogether for any event. I mean if you refer 2nd screenshot in my question you will see I can select only one parameter/Custom Dimension at a time and same if I decide to export it to cdv file. Commented Jun 19, 2014 at 19:10
  • Why not put all three parameters into one dimension? And delimit it by a colon or dash. Commented Jun 19, 2014 at 20:13
  • That sounds like a good work around. But that way I will get everything in one cell while export to csv file and my marketing fellow wants all custom dimensions separate for each event. I don't have much knowledge about scripting but maybe I can separate that custom dimensions joined by delimiters, right? Commented Jun 19, 2014 at 20:26
  • I have started using Google API PHP for pulling out data as per our need as a solution. Do you think that is a good idea? Commented Jun 19, 2014 at 20:30

3 Answers 3

1

you can send custom data to google analytics by using custom dimension.

you need to add custom dimension from your dashboard after adding that you will get the code..

Just integrate that in your project and follow below link to see the values.

http://www.lunametrics.com/blog/2013/09/10/access-custom-dimensions-google-analytics/#sr=g&m=o&cp=or&ct=-tmc&st=hpphmf%20dvtupn%20ejnfotjpo&ts=1384845402 enter image description here

0
0

I never used custom parameters with GA, anyway I think this can help you.

  1. Open your Analytics in Behavior/Top Events.

Behavior/Top Events

  1. Select any primary dimension and click over Secondary Dimension.

Secondary Dimension

  1. Click over Custom Variables to expand it.

Custom Variables

  1. Finally, select the variables your want to analise.

Custom Variables

0

Now there is another solution for Google users.

There is another solution since Google set Firebase as a default for mobile application solution.

Firebase is Google's mobile app developer platform and helps developers incorporate Google's mobile app services quickly and easily – including Google Analytics.

Here is how Google Analytics changed the way of adding new property under Analytics admin page:

enter image description here

You can use Firebase send events like how in Flurry.

Try this method to send events:

[FIRAnalytics logEventWithName:kFIREventSelectContent
                    parameters:@{
                                 kFIRParameterItemID:[NSString stringWithFormat:@"id-%@", self.title],
                                 kFIRParameterItemName:self.title,
                                 kFIRParameterContentType:@"image"
                                 }];

There is no limit on the total volume of events your app logs.

View events in the dashboard

You can view aggregrated statistics about your Analytics events in the Firebase console dashboards. These dashboards update periodically throughout the day. For immediate testing, use the debug console output as described in the previous section.

You can access this data in the Firebase console as follows:

  1. In the Firebase console, open your project.
  2. Select Analytics from the menu to view the Analytics reporting dashboard.

The Events tab shows the event reports that are automatically created for each distinct type of Analytics event logged by your app. Read more about the Analytics reporting dashboard in the Firebase Help Center.

You can add Firebase using cocoapods. Add the dependency for Firebase to your Podfile:

pod 'Firebase/Core'

Run pod install and open the created .xcworkspace file.

Import the Firebase module in your UIApplicationDelegate subclass:

import Firebase

Configure a FIRApp shared instance, typically in your application's application:didFinishLaunchingWithOptions: method:

// Use Firebase library to configure APIs
FirebaseApp.configure()
1
  • Wow. Gotta check this out next time I use GA. Thank you for the input. Commented Jun 13, 2017 at 20:09

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.