Tagging plan

Simple action

Call the method triggerAction to send a tag

//this --> Context
//"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 »).

HashMap properties = new HashMap();
properties.put("zipcode", "33000");
properties.put("profession", "restaurant");
APMPublic.sharedInstance(this).triggerAction("note", properties);

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

Dynamic action

For a dynamic action, we need to create a APMAction object and call registerAction before calling triggerAction

//Example with a tag "display_product", 
// "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
String label1 = "un produit quelconque";
String label2 = String.format("un produit de la catégorie %1$s", m_category.name);
String label3 = String.format("le produit %1$s", m_product.name);
String[] labels = new String[]{label1, label2, label3};

//Create a list of properties
String property1 = "display_product";
String property2 = String.format("categoryID=%1$s", ""+m_category.categoryID);
String property3 = String.format("productID=%1$s", ""+m_product.productID);
String[] properties = new String[]{property1, property2, property3};

//Create APMAction with actionName, properties, labels and classID
APMAction actionDisplayProduct = new APMAction("display_product", 
                                               "PRODUCT"); //The action "display_product" will be grouped in string "PRODUCT"
APM apm = APMPublic.sharedInstance(this); //this --> Context
apm.registerAction(actionDisplayProduct); //Register your action
apm.selectClassID("PRODUCT"); //Call this, to show (in admin in-app) all actions grouped in string "PRODUCT"
apm.triggerAction("display_product"); //Call this after register your action to send tag


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

Last updated