Custom tree structure

  • iOS
  • watchOS
  • tvOS
 

Foreword

AT Internet’s 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 methodenabling you to add different categories that make up your tree structure, and add them to your screen hit.

 

Tagging example

  1. 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

NameTypeDefault valueDescription
category1Int0Gets or sets the tree structure’s main category
category2Int0Gets or sets the tree structure’s subcategory
category3Int0Gets or sets the tree structure’s sub-subcategory
Last update: 01/12/2016