Tagging plan

Simple action

Call triggerAction for send a tag

#import <APM/APMHeaders.h>

.....

[[APM sharedInstance] triggerAction:@"display_product"]; //"display_product" --> actionName

Simple action with properties

Call triggerAction for send a tag with properties – key : Property keys are strings. (e.g. « zipcode », « profession »). – value : Property values are strings. (e.g. « 33000 », « restaurant »).

NSMutableDictionary* properties = [NSMutableDictionary dictionary];
properties[@"zipcode"] = @"33000";
properties[@"profession"] = @"restaurant";
[[APM sharedInstance] triggerAction:@"note" properties:properties];

The tag matches with this action « Notez un restaurant à Bordeaux ».

Dynamic action

For dynamic action, we need to registerAction before call triggerAction

//Example with a tag "display_product", 
// ACTION / LABEL / PROPERTY
// "Affichez un produit quelconque" / "un produit quelconque" / "display_product"
// "Affichez un produit de la catégorie SPORT" / "un produit de la catégorie <CATEGORY_NAME>" / "categoryID=<CATEGORY_ID>"
// "Affichez le produit Chaussure Nike" / "le produit <PRODUCT_NAME>" / "productID=<PRODUCT_ID>"

//Create a list of labels
NSString* label1 = @"un produit quelconque";
NSMutableString* label2 = [NSMutableString stringWithFormat:@"un produit de la catégorie %@", self.category.name];
NSMutableString* label3 = [NSMutableString stringWithFormat:@"le produit %@", self.product.name];
NSArray* labels = @[label1, label2, label3];

//Create a list of properties
NSString* property1 = @"display_product";
NSMutableString* property2 = [NSMutableString stringWithFormat:@"categoryID=%ld", (long)self.category.categoryID];
NSMutableString* property3 = [NSMutableString stringWithFormat:@"productID=%ld", (long)self.product.productID];
NSArray* properties = @[property1, property2, property3];

//Create APMAction with actionName, properties, labels and classID
APMAction *actionDisplayProduct = [[APMAction alloc] initWithAction:@"display_product"
                                            withLabels:labels
                                        withProperties:properties
                                            forClassID:@"PRODUCT"]; //The action "display_product" will be grouped in string "PRODUCT"
[[APM sharedInstance] registerAction:actionDisplayProduct]; //Register your action
[[APM sharedInstance] selectClassID:@"PRODUCT"]; //Call this, to show (in admin in-app) all actions grouped in string "PRODUCT"
[[APM sharedInstance] triggerAction:@"display_product"]; //Call this after register your action to send tag

ClassID

The « classID » allows to group the different actions. By default, all simple actions are grouped to « global »

Last updated