      *  @param tagName  The tag name
      *  @param parameters   Dictionary of parameters
      */
-    override func execute(tagName: String, parameters: [NSObject : AnyObject]) {
+    override func execute(_ tagName: String, parameters: [AnyHashable: Any]){
         super.execute(tagName, parameters: parameters);
         
         switch (tagName) {
         case FB_initialize:
-            self.initialize(parameters);
+            self.initialize(parameters: parameters);
             break ;
         case FB_activateApp:
             self.activateApp();
             break ;
         case FB_tagEvent:
-            self.tagEvent(parameters);
+            self.tagEvent(parameters: parameters);
             break ;
         case FB_purchase:
-            self.purchase(parameters);
+            self.purchase(parameters: parameters);
             break ;
         default:
             noTagMatch(self, tagName: tagName);
         }
     }
-    
-    
-    /* ********************************** Specific methods ************************************* */
-    
+
+    /**
+     *  Initialize Facebook SDK with the Application id given by Facebook when Facebook app has benn created
+     */
+    func initialize(parameters: [AnyHashable: Any]){
+        if let applicationId = parameters["applicationId"]{
+            AppEventsLogger.loggingAppId = applicationId as? String;
+            cargo.logger.logParamSetWithSuccess("applicationId", value: applicationId, handler: self);
+        }
+        self.activateApp()
+    }
+
+    /**
+     * Activate events logging
+     */
+    func activateApp(){
+        AppEventsLogger.activate(UIApplication.shared);
+        cargo.logger.carLog(kTAGLoggerLogLevelInfo, handler: self, message: "Facebook activateApp sent.");
+    }
+
+
+/* ********************************** Specific methods ************************************* */
+
     /**
      *  Send an event to facebook SDK. Calls differents methods depending on which parameters have been given
      *  Each events can be logged with a valueToSum and a set of parameters (up to 25 parameters).

//

import Foundation
import FBSDKCoreKit
import FBSDKCoreKit.FBSDKAppEvents


class CARFacebookTagHandler: CARTagHandler {
    
    /* ********************************* Variables Declaration ********************************* */
    
    let FB_initialize = "FB_initialize";
    let FB_activateApp = "FB_activateApp";
    let FB_tagEvent = "FB_tagEvent";
    let FB_purchase = "FB_purchase";
    
    /* ************************************* Initializer *************************************** */
    
    /**
     *  Initialize the handler

        cargo.registerTagHandler(self, key: FB_tagEvent);
        cargo.registerTagHandler(self, key: FB_purchase);
    }


/* ******************************** Core handler methods *********************************** */

    /**
     *  Call back from GTM container to execute a specific action
     *  after tag and parameters are received
