Developers » Windows » Content » Custom screen and application variables
Custom screen and application variables
Foreword
Custom application variables allow you to associate information with a users activity while s/he is using your application.
Custom screen variables focus on a view in particular, and allow you, notably, to tag the fields of an entry form.
Get off to a good start
Once your tag is initialised, you can add your custom variables to your screen hit.
To use SDK class and methods, add ATInternet namespace to your Page.
Tagging
The tracker makes available a CustomVars-type object that exposes an Add method. This method accepts three parameters:
- VarId: index of the indicator
- Value: value of the indicator, character string in the format:
- text: [lorem]
- decimal: , or . separator, two characters maximum after the separator
- date: yyyymmdd
- country: ISO
- duration: integer
- Type: type of indicator
Tagging example
- Site indicator, with a date value
using System; using System.Collections.Generic; using Windows.Data.Json; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using ATInternet; using Windows.UI.Xaml.Navigation; namespace App1 { public sealed partial class MainPage : Page { Tracker tracker; public MainPage() { this.InitializeComponent(); tracker = SmartTag.Instance.defaultTracker; tracker.CustomVars.Add(1, "345687", CustomVarType.App); tracker.Screens.Add("My Screen with a CustomVar").SendView(); } } }
- Screen indicator, with a text value
using System; using System.Collections.Generic; using Windows.Data.Json; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using ATInternet; using Windows.UI.Xaml.Navigation; namespace App1 { public sealed partial class MainPage : Page { Tracker tracker; public MainPage() { this.InitializeComponent(); tracker = SmartTag.Instance.defaultTracker; tracker.CustomVars.Add(2, "[object]", CustomVarType.Screen); tracker.Screens.Add("My Screen with a CustomVar").SendView(); } } }
CustomVar class
Properties
Name | Type | Default value | Description |
---|---|---|---|
VarId | Int | -1 | Gets or sets the variable ID |
Type | Enum | CustomVarType.App | Gets or sets the variable type |
Value | String | Empty string | Gets or sets the variable value |