Skip to content
This repository was archived by the owner on May 5, 2026. It is now read-only.

MV Testing 7f69f8

Benjamin Diolez edited this page May 5, 2026 · 1 revision

Data collection / Apple / Content / MV Testing

Get off to a good start

Once your tag is initialised, you can start tagging MV Testing enabling the measurement of different design and content combinations for a single application.

In the case of a Swift project, be sure to import the Tracker (or TrackerExtension if your target is an extension) module in your ViewController. In the case of an Objective-C project, be sure to import the headers Tracker-Swift.h or SmartTracker-Swift.h

Declare a Tracker variable in your ViewController.

import UIKit
import Tracker

class ViewController: UIViewController {
    let tracker: Tracker = ATInternet.sharedInstance.defaultTracker
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
}
#import "Tracker/Tracker-Swift.h"

@interface ViewController ()
@property (nonatomic, strong) Tracker *tracker;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tracker = [ATInternet sharedInstance].defaultTracker;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

Tagging

The trackerexposes a MvTestingsproperty offering an add method***.***

This method enables the addition of content tagging which can be sent at the desired moment (e.g. viewDidLoad, viewWillAppear …).

The addmethod sends back a MvTesting-type object. To send the defined information, you must manually call the Tracker�’s dispatchmethod.

The method can take several different parameters:

  1. A character string composed of an identifier and the test name in ID[name_test] format.
  2. An integer representing the wave identifier (set of creations).
  3. A character string composed of an identifier and the name of the creation (combination of versions for each of the variables) in ID[name_creation] format.

The returned MvTesting object itself exposes a variables property offering an add method.

This method can take several different parameters:

  1. A character string composed of an identifier and the name of the variable concerned in ID[name_variable] format.
  2. A character string composed of an identifier and the name of the version concerned in ID[name_version] format.

For test and creation:

  • if you only enter the ID, a name will be automatically generated,
  • if you only enter the name, an ID will be automatically generated,
  • if you enter an ID and a name, both will be saved.

Tagging examples

override func viewWillAppear(_ animated: Bool) {
    let mvt = tracker.mvTestings.add("1[My_first_Test]", waveId: 1, creation: "2[Version2_page_subscription]")
    _ = mvt.variables.add("1[Header]", version: "2[Grey]")
    _ = mvt.variables.add("2[Header]", version: "4[Black]")
    tracker.dispatch();
}
- (void)viewWillAppear:(BOOL)animated {
    MvTesting *mvt =  [tracker.mvTestings add:@"1[My_first_Test]" waveId: 1 creation: @"2[Version2_page_subscription]"];
    (void)[mvt.variables add:@"1[Header]" version:@"2[Grey]"];
    (void)[mvt.variables add:@"2[Header]" version:@"4[Black]"];
    [tracker dispatch];
}

Wiki contents

Clone this wiki locally