-
Notifications
You must be signed in to change notification settings - Fork 0
Custom Object
The SDK allows the addition of all sorts of information to the stc variable via dictionaries or JSON feeds. Custom objects can be added to any type of tagging, and can then be treated via the Data Manager tool.
Once your tag is initialised, you can add your custom objects to your hits.
In the case of a Swift project, be sure to import the Tracker (or tvOSTracker / watchOSTracker if your target is an Apple TV or an Apple Watch) module in your ViewController. In the case of an Objective-C project, be sure to import the headers TrackerSmart-Swift.h or Tracker-Swift.h in case of a Cocoapods integration
To add a custom object to your hits, the Screenobject exposes object a customObjects property possessing an add method. This method allows for the addition of a custom object that will be added to the next hit sent.
-
Tagging a screen with addition of a “simple” custom object
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")
screen.customObjects.add(["firstName": "John", "age": 26, "name": "Doe"])
screen.sendView()
}
}#import "Tracker/Tracker-Swift.h"
@interface ViewController ()
@property (nonatomic, strong) Tracker* tracker;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.tracker = [ATInternet sharedInstance].defaultTracker;
self.tracker.debugger = self;
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
Screen *screen = [[tracker screens ] add:@"Home"];
[screen.customObjects addDictionary:@{@"firstName": @"John", @"age": @26, @"name": @"Doe"}];
[screen sendView];
}
@endJSON result in ***stc*** variable :
{
"lifecycle": {
"fl": 0,
"fld": 20151014,
"dsfl": 1,
"flau": 0,
"dslu": 0,
"lc": 57,
"lcsu": 0,
"ldc": 9,
"lwc": 57,
"lmc": 57
},
"firstName": "John",
"age": 26,
"name": "Doe"
}-
Tagging a screen with addition of a “complex” custom object
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")
_ = screen.customObjects.add(["user" : ["language": "en", "country": "US", "currency" : "USD"]])
screen.sendView()
}
}#import "ViewController.h"
#import "Tracker/Tracker-Swift.h"
@interface ViewController ()
@property (nonatomic, strong) Tracker* tracker;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.tracker = [ATInternet sharedInstance].defaultTracker;
self.tracker.debugger = self;
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
Screen *screen = [[tracker screens ] add:@"Home"];
[screen.customObjects addDictionary:@{@"user": @{@"language": @"en", @"country": @"US", @"currency": @"USD"}}];
[screen sendView];
}
@endJSON result in ***stc*** variable :
{
"lifecycle": {
"fl": 0,
"fld": 20151014,
"dsfl": 1,
"flau": 0,
"dslu": 0,
"lc": 58,
"lcsu": 0,
"ldc": 10,
"lwc": 58,
"lmc": 58
},
"user": {
"language": "en",
"currency": "USD",
"country": "US"
}
}-
Tagging navigation with the addition of a custom object
import UIKit
import Tracker
class ViewController: UIViewController {
let tracker: Tracker = ATInternet.sharedInstance.defaultTracker
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewWillAppear(_ animated: Bool) {
let gesture = tracker.gestures.add("Navigate Home")
gesture.customObjects.add(["user" : ["language": "en", "country": "US", "currency" : "USD"]])
gesture.sendNavigation()
}
}#import "ViewController.h"
#import "Tracker/Tracker-Swift.h"
@interface ViewController ()
@property (nonatomic, strong) Tracker* tracker;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.tracker = [ATInternet sharedInstance].defaultTracker;
self.tracker.debugger = self;
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
Gesture *gesture = [[tracker gestures] add:@"Navigate Home"];
[gesture.customObjects addDictionary:@{@"user": @{@"language": @"en", @"country": @"US", @"currency": @"USD"}}];
[gesture sendNavigation];
}
@end-
Tagging an ad with the addition of a custom object
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()
_ = screen.customObjects.add(["user" : ["language": "en", "country": "US", "currency" : "USD"]])
_ = screen.publishers.add("[ad1]")
screen.sendView()
}
}#import "ViewController.h"
#import "Tracker/Tracker-Swift.h"
@interface ViewController ()
@property (nonatomic, strong) Tracker* tracker;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.tracker = [ATInternet sharedInstance].defaultTracker;
self.tracker.debugger = self;
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
Screen *screen = [[tracker screens] add];
[screen.customObjects addDictionary:@{@"user": @{@"language": @"en", @"country": @"US", @"currency": @"USD"}}];
[screen.publishers add:@"[ad1]"];
[screen sendView];
}
@end-
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