tipi converson
swift3
Ekran Parça
let tracker = GAI.sharedInstance().defaultTracker
tracker.set(kGAIScreenName, value: "Home")
tracker.send(GAIDictionaryBuilder.createScreenView().build() as [AnyHashable : Any])
amaç-Cı
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
// Set the screen name on the tracker so that it is used in all hits sent from this screen.
[tracker set:kGAIScreenName value:@"Home"];
[tracker send:[[GAIDictionaryBuilder createScreenView] build]];
Otomatik Ekran İzleme
swift3
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
self!.screenName = "About Screen"
}
Objective-C
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
self.screenName = @"About Screen";
}
olay Parça
swift3
let tracker = GAI.sharedInstance().defaultTracker
tracker!.send(GAIDictionaryBuilder.createEventWithCategory("ui_action", action: "button_press", label: "menuButton", play: nil).build())
Amaç-Cı
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
[tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"ui_action" // Event category (required)
action:@"button_press" // Event action (required)
label:@"play"
value:nil] build]];
veya için
weak var tracker = GAI.sharedInstance().defaultTracker
// Set screen name on the tracker to be sent with all hits.
tracker!.set(kGAIScreenName, value: "Home Screen")
// Send a screen view for "Home Screen".
// [tracker send:[[GAIDictionaryBuilder createAppView] build]];
// Previous V3 SDK versions.
tracker!.send(GAIDictionaryBuilder.createScreenView().build())
// SDK Version 3.08 and up.
// This event will also be sent with &cd=Home%20Screen.
tracker!.send(GAIDictionaryBuilder.createEventWithCategory("UX", action: "touch", label: "menuButton", value: nil).build())
// Clear the screen name field when we're done.
tracker!.set(kGAIScreenName, value: nil)
kullanımı Daha fazla bilgi this
örnek
olay Takip ekran pist
let tracker = GAI.sharedInstance().defaultTracker
tracker.set(kGAIDescription, value: "rootPlayView")
let builder: NSObject = GAIDictionaryBuilder.createScreenView().build()
tracker.send(builder as! [NSObject : AnyObject])
için bu
var builder = GAIDictionaryBuilder.createScreenView().build() as! [NSObject : AnyObject]
tracker.send(builder)
deneyin bakın
let tracker = GAI.sharedInstance().defaultTracker
let builder: NSObject = GAIDictionaryBuilder.createEventWithCategory(
"xxxx",
action: "buttonclicked",
label: "you pressed xxx button",
value: nil).build()
tracker.send(builder as! [NSObject : AnyObject])
Hızlı 3 ile ilgili herhangi bir fikir var mı? –
@ JoãoNunes - Bu durumda güncellenmiş cevabı kontrol edin –
izci bu durumda isteğe bağlıdır ve unwrapping gerektirir. Bu benim için çalıştı. 'izci = GAI.sharedInstance() defaultTracker izin verirsen { tracker.set (kGAIDescription, değer: "rootPlayView") let oluşturucu:. NSObject = GAIDictionaryBuilder.createScreenView()() izci kurmak. göndermek (builder! [NSObject: AnyObject]) } ' –