This repository was archived by the owner on May 5, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Notifications 578ef7
Benjamin Diolez edited this page May 5, 2026
·
1 revision
Push notifications can trigger two application delegate methods depending on the context:
The delegate methods will only be triggered if the user touches the action button or message notification, and not the close/cancel button.
- application:didFinishLaunchingWithOptions: This method is called if the application has not yet been launched. The application will then be launched and the notification will be available in the �launchOptions� dictionary.
- application:didReceiveRemoteNotification: This method is called if the application has already been launched and is currently running or is in the background.
Tagging of notifications is done in the body of these methods.
-
To measure a notification that was received when the application had not yet been launched, if the notification contains a reference to the campaign (in the �xto� key)
import UIKit
import Tracker
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
if let notification = launchOptions?[UIApplicationLaunchOptionsRemoteNotificationKey] as? NSDictionary {
if let campaign = notification["xto"] as? String {
ATInternet.sharedInstance.defaultTracker.campaigns.add(campaign)
}
ATInternet.sharedInstance.defaultTracker.screens.add("PushNotification").sendView()
}
return true
}
}#import "AppDelegate.h"
#import "SmartTracker/SmartTracker.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSDictionary *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if (notification) {
[ATInternet.sharedInstance.defaultTracker.campaigns add:[notification objectForKey:@"xto"]];
}
[[ATInternet.sharedInstance.defaultTracker.screens add:@"PushNotification"] sendView];
return YES;
}
@end-
To measure a notification if the application is currently running or is in the background, if the notification contains a reference to the campaign (in the �xto� key)
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
if let notification = userInfo[UIApplicationLaunchOptionsRemoteNotificationKey] as? NSDictionary {
if let campaign = notification["xto"] as? String {
ATInternet.sharedInstance.defaultTracker.campaigns.add(campaign)
}
ATInternet.sharedInstance.defaultTracker.screens.add("PushNotification").sendView()
}
}- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
if ([userInfo objectForKey:@"xto"]) {
[ATInternet.sharedInstance.defaultTracker.campaigns add:[userInfo objectForKey:@"xto"]];
}
[[ATInternet.sharedInstance.defaultTracker.screens add:@"PushNotification"] sendView];
}-
Data API
- Data flow
- Advice optimizations data flow
- Error codes data flow
- Faq data flow
- General information data flow
- Technical information data flow
- Reporting API v3
- Getting started
- Methods
- Parameters
- Technical information
- REST API
- Campaigns
- Custom variables
- Getting started rest
- Methods rest
- Response structure parameters rest
- Fixed periods
- Parameters compatibility
- Relative periods
- Structure of the response
- “code” parameter
- “columns” parameter
- “evo” parameter
- “filter” parameter
- “include” parameter
- “lng” parameter
- “max-results” parameter
- “page-num” parameter
- “period” parameter
- “period” parameter: “H” v. “He” & “MN” v. “MNe”
- “retention” parameter
- “segmentdesc” parameter
- “segment” parameter
- “sep” parameter
- “sort” parameter
- “space” parameter
- Technical specifications rest
- Data flow
-
Data collection
- Android
- Advanced features
- Campaigns
- Changelog
- Content
- Ecommerce
- Getting started
- Users
- Apple
- Advanced features
- Campaigns
- Changelog
- Content
- Ecommerce
- Getting started
- Users
- General
- Cddc renew staging process
- Changelog
- Craft your hit
- Encoded parameters
- Server side cookie management
- Supported taggings
- Tagging deletion
- Utilisation of dispatch sdks
- JavaScript
- Advanced features
- Campaigns
- Changelog
- Content
- Ecommerce
- Getting started
- Partners javascript
- Users
- Piano Analytics
- Event tagging piano analytics
- Getting started piano analytics
- Piano analytics tagging
- Feeding piano analytics with as2 tagging
- Tagging custom properties sdk
- Android