Developers » AS2 tagging » Apple » Content » Custom tree structure
Custom tree structure
- iOS
- watchOS
- tvOS
Foreword
AT Internets SDK lets you create a custom tree structure for your application.
Thanks to this feature, you can get a completely customised view of your traffic that responds precisely to your analysis criteria.
To do this, you must use screen categories. They represent a new way of classifying your screens, complementary to chapters, enabling a lateral view of results.
Get off to a good start
Once your tag has been initialised, you can create your custom tree structure.
In the case of a Swift project, be sure to import the SmartTracker module in your ViewController. In the case of an Objective-C project, be sure to import the headers SmartTracker-Swift.h
Tagging
The Screen object makes available a CustomTreeStructure property. This property exposes an add method, enabling you to add different categories that make up your tree structure, and add them to your screen hit.
Tagging example
- Create a custom tree structure
import UIKit import Tracker class ViewController: UIViewController { let tracker: Tracker = ATInternet.sharedInstance.defaultTracker override func viewDidLoad() { super.viewDidLoad() } override func viewWillAppear(animated: Bool) { let screen = tracker.screens.add("Home") // First method screen.customTreeStructure = CustomTreeStructure(category1: 5, category2: 8, category3: 4) // Second method screen.customTreeStructure = CustomTreeStructure(category1: 5) screen.customTreeStructure?.category2 = 8 screen.customTreeStructure?.category3 = 8 screen.sendView() // &ptype=5-8-4 } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } }
#import "ViewController.h" #import "SmartTracker/SmartTracker-Swift.h" @interface ViewController () @property (nonatomic, strong) ATTracker *tracker; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; self.tracker = [ATInternet sharedInstance].defaultTracker; } - (void)viewWillAppear:(BOOL)animated { // First method Screen *screen = [[tracker screens ] add:@"Home"]; screen.customTreeStructure = [[CustomTreeStructure alloc] initWithCategory1:5 category2:8 category3:4]; // Second method CustomTreeStructure* cts = [[CustomTreeStructure alloc] initWithCategory1:5]; cts.category2 = 8; cts.category3 = 4; screen.customTreeStructure = cts; [screen sendView]; // &ptype=5-8-4 } @end
CustomTreeStructure class
Properties
Name | Type | Default value | Description |
---|---|---|---|
category1 | Int | 0 | Gets or sets the tree structures main category |
category2 | Int | 0 | Gets or sets the tree structures subcategory |
category3 | Int | 0 | Gets or sets the tree structures sub-subcategory |