IPhone Application Conversion Tracking
From QuattroWiki
To make it easy for iPhone application developers to track downloads of their applications, Quattro provides a simple and flexible conversion tracking feature. Use this feature if you advertise your own application within someone else's application. When a user clicks on your advertisement and ultimately downloads the application from the Apple App Store, Quattro registers the conversion event. To implement conversion tracking, you may or may not need to do something, depending on how you have integrated with the Quattro Wireless Mobile Ad Platform.
Contents |
For Publishers Using the iPhone SDK
If you are an application publisher and have used the iPhone SDK, conversion tracking is implemented automatically.
For Advertisers Not Using the iPhone SDK
To implement conversion tracking, you'll need to do two things: Name your 'conversion action' and get your code. When a consumer downloads an app (after clicking an ad from within another application), it's called a conversion action. You need to give the conversion action a name so that you can recognize the conversions in your reports.
Have multiple apps? Make sure to set up conversion tracking for each unique app. You’ll need to setup unique names for each of your conversion actions (one per app that you want to track). On the portal, choose your advertiser name from the list and then click Add New Conversion Action. Populate the fields and Save – you’ll then be able to select it from the list, and get the code you need.
I’m an advertiser, what method should I use to report conversion to Quattro?
When you go to get your code, you have two options. The first is to get a client side Objective-C code snippet that contains the conversion action name you assign, and integrate it into your app. The second is to get a server side conversion API to log conversions on a server.
- Objective-C Code Snippet – You should include the Code Snippet method in you application if you are not planning to run Quattro ads in your application, but you want to have the conversion automatically reported to Quattro as users download your application. This change will require an App Store submission for your application. Don’t forget that you’ll need multiple code snippets if you have multiple apps.
- Server-Side Conversion API – You should use this if you are already collecting UDIDs from new users when they download your application. If you are already collecting that data you can be up and running with conversion tracking quickly just by getting your advertiser ID from the Quattro online portal under the "Configure Application Conversion Tracking" tab.
To add the Objective-C code snippet:
Step 1: Add the following method to the Application Delegate class:
/*
This method makes a call to the Quattro Ad Server to register this application. The registration happens
once based on the flag set in User Defaults.
*/
-(void)registerAppOnQuattro
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSBundle *appBundle = [NSBundle mainBundle];
NSString *name = [NSString stringWithFormat:@"%@_QWRegister", [appBundle objectForInfoDictionaryKey:@"CFBundleDisplayName"]];
BOOL val = [defaults boolForKey:name];
//Check if already registered
if(val == NO)
{
NSString* udid = [[UIDevice currentDevice] uniqueIdentifier];
NSString* url = [NSString stringWithFormat:@"http://ad.qwapi.com/adserver/logAction?advid=%@&udid=%@",
{ADVERTISER_ID}, udid];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
NSURLResponse *urlResponse;
NSError *error;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&error];
int code = (urlResponse ? [NSHTTPURLResponse *)urlResponse statusCode] : -1);
if (!error && (code == 200)) {
//set the flag in the User Defaults
[defaults setBool:YES forKey:name];
}
}
[pool release];
}
Step 2: Call the method defined above from the following method of application delegate:
applicationDidFinishLaunching [self performSelectorInBackground:@selector(registerAppOnQuattro) withObject:nil];
Note: You need to ensure that access to the NSUserDefaults is thread safe.
To Use the Server Side Conversion Tracking API:
If it isn’t possible to include the code snippet in your application, or you can’t re-submit to the App Store, conversions can be logged to a server. Invoke an HTTP Connection and initiate an HTTP Get for the URL as shown.
You'll need to post conversions to the conversion action registration URL:
http://ad.qwapi.com/adserver/logAction?advid={advertiserId}&udid={udid}
Required Parameters
type: Optional return type = img. Will return a 1x1 image.sid: Site ID for the conversion action to be logged.action: Name of the conversion action to be logged.advid: Unique Advertiser ID given to all advertisers registered with Quattro.udid: Unique Device ID.
If the conversion is successfully logged, an HTTP status code of 200 is returned.
Example
http://ad.qwapi.com/adserver/logAction?advid=b33eb94ffbce48bd8301a5476039cb63&udid=7825443e583d49b7ad2fd9473f9edfd230c0c932
This request will register a single conversion action with the AdServer and your conversion metrics will be available on the Quattro Wireless reporting portal.
iPhone Conversion Tracking FAQs
Q: What inventory on Quattro’s network is eligible to display ads that require conversion tracking?
A. iPhone conversion tracking is only available for in-application advertising. Ads that advertise your application will only appear on other applications in Quattro's network. They will not appear on mobile sites.
Q: When will I see conversion data in Quattro’s reporting portal?
A. Data will be available within 24 hours of when the conversion is reported. The conversions will be recorded for the day the conversion happened.
Q: If I install the code snippet does the application try and report to Quattro every time a user launched the app? A. No, once the application launches the first time and logs a successful conversion request that is it.
Q: What happens if a user installs my application and it is used for the first time when the user has no network connectivity? Does the conversion code retry?
A. Yes, in that case we would not see a valid 200 status response. In any error situation the conversion code will retry until it gets a valid success message returned.
Q: If I use the Server-Side Conversion API to report downloads, how often can I submit reports?
A. You can submit as often as you like; Quattro will only record one conversion per UDID.
Q: What is a UDID?
A. UDID stands for Unique Device Identifier returned by all the iPhone and iTouch devices. A unique device identifier is a hash value composed from various hardware identifiers such as the device’s serial number. It is guaranteed to be unique for every device.
Q: How do I get a UDID from an iPhone application (code sample)?
UIDevice *device = [UIDevice currentDevice]; NSString* udid = [device uniqueIdentifier]
