Glazum SDK usage

Make sure you include the Glazum library header in every file where Glazum is used.
#import <Glazum/Glazum.h>

General initialization

Initialize Glazum with one line of code, in application:didFinishLaunchingWithOptions:
- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {   
	// ...
	[Glazum startUp:@"YOUR-APP-IDENTIFIER"];
	// ...
}

Note the single argument of the startUp call. It is your application’s identifier. Every time you add an application to Glazum dashboard, an identifier is generated. All the answers received by Glazum backend are grouped by these identifiers. Please check the dashboard to see identifiers of the applications you’ve already added or to add a new one.

Markers

Place named markers wherever you need in your code. Later you will bind questions to these markers.

[Glazum setMarker:@"button pressed"];

Markers in the code identify places where Glazum is allowed to show questions. Please note that it doesn’t mean that a question will be shown every time the marker’s code is executed. Glazum allows you to set a list of conditions required to show a question to the user. The question will be shown only when all these conditions are met.

Setting markers is a one-time operation. You don’t need to do any code changes to your app in order to add/edit or turn on/off questions. Our advice is to set as many markers as possible.

Please note, that there are two system markers :app launched and :app entered foreground. Therefore there is no need manually set markers for these events.

Questions preview

If you wonder how question will look like in your app, just use:

[Glazum testQuestionWithType:kQuestionWithSingleLineTextAnswer];
where kQuestionWithSingleLineTextAnswer is one of the five available question types:
typedef enum {
    kQuestionWithSingleLineTextAnswer,
    kQuestionWithMultiLineTextAnswer,
    kQuestionWithSingleAnswerSelection,
    kQuestionWithMultipleAnswerSelection,
    kQuestionWithNetPromoterScore
}GlazumQuestionType;

Before and after callbacks

You can specify code blocks that will be called before and after a question is shown.

doBefore block takes one boolean argument willShowQuestion. When it's true, the question will be asked right after this block is executed. doAfter block takes one argument questionWasShown. If questionWasShown is true, the question was actually shown.

Using doBefore/doAfter may be useful for preparing your app for showing question and resuming its previous state after the question is shown.

[Glazum setMarker:@"button pressed"
	   doBefore:^(BOOL willShowQuestion) {
	 	//prepare application for the question to be asked
}
	    doAfter:^(BOOL questionWasShown) {
	  	//cleanup everything and restore previous state
}];

Please note, that you can pass nil instead of either doBefore or doAfter.

[Glazum setMarker:@"button pressed"
	   doBefore:nil
	    doAfter:^(BOOL questionWasShown) {
	  	//cleanup everything and resume your app
}];

Identify your app users

If your app in some way indentify users, you can do this with Glazum too. For example, to identify the user with his email (authenticate) just call:
[Glazum setUserIdentifier:@"test@example.com"];
When Glazum:setUserIdentifier is called, user identifier value is stored permantently and applied to all markers that are executed afterwards. To remove user identifier (for example to deauthenticate user) just call setUserIdentifier with nil argument:
[Glazum setUserIdentifier:nil];

Set additional properties

Aside from identifying your app's users, you can set question showing criteria based on a custom variable. To use custom variables just call:
[Glazum setCustomVariable:@"true" named:@"ab test share"];
The value will be stored permanently. To remove it call setCustomVariable with nil variable argument:
[Glazum setCustomVariable:nil named:@"ab test share"];

Setting Glazum options

GlazumOptionDebug

If you need Glazum log messages in your console, just set GlazumOptionDebug option like this:

[Glazum setOptions:@{GlazumOptionDebug:@YES}];

GlazumOptionDebugLogHandler

If you have your own custom logger, you can set custom block to receive all debug messages

[Glazum setOptions:@{GlazumOptionDebugLogHandler:^(NSString *message) {
            //your custom debug logger logic
        }
}];