Latest 1.0.0
Homepage https://github.com/NetcoreSolutions/Smartech-ios-gtm-sdk
License Commercial https://github.com/NetcoreSolutions/Smartech-ios-gtm-sdk/LICENSE
Platforms ios 8.0, requires ARC
Authors

Netcore Logo Smartech-ios-gtm-sdk

Integration Steps for Netcore GTM SDK for iOS

Prerequisites for Integration:

Before getting started:

  1. In the Firebase console, add app to your Firebase project.
  2. Legacy Server Key from Firebase project.
  3. App ID from Smartech Panel.

Some extra prerequisites: (Required if using GTM for Activity Tracking)

  1. Add Firebase Analytics to your app.
  2. Create a Google Tag Manager account.
  3. Configure a Google Tag Manager container.

For reference go through prerequisites of GTM from link below:
Reference Link

For FCM setup in application: (Avoid if already setup)

  1. Add GoogleService-Info.plist file in app directory of project.
  2. Import Firebase in app delegate file

    Objective-C:
    @import Firebase;
    Swift:
    import Firebase

  3. In Application didFinishLaunchingWithOptions add,

    Objective-C:
    [FIRApp configure];
    [NetCorePushTaskManager sharedInstance].delegate = (id)self;
    [[NetCoreSharedManager sharedInstance] handleApplicationLaunchEvent:launchOptions forApplicationId:@""];
    Swift:
    FirebaseApp.configure()
    NetCoreSharedManager.sharedInstance().handleApplicationLaunchEvent(launchOptions, forApplicationId: "")
    NetCorePushTaskManager.sharedInstance().delegate = self as! NetCorePushTaskManagerDelegate
    Note: Replace with the one that is obtained from Smartech panel

  4. In application’s didRegisterForRemoteNotificationsWithDeviceToken add,

    Objective-C:
    [[NetCoreInstallation sharedInstance] netCorePushRegisteration:@"Block:^(NSInteger statusCode) {}];
    Swift:
    NetCoreInstallation.sharedInstance().netCorePushRegisteration(" ", withDeviceToken: deviceToken){(code) in}
    Note: must be “”(blank) or Primary Key as defined on Smartech panel

  5. If app supports iOS version less then 10.0

    Objective-C:

    • (void)application:(UIApplication)application
      didReceiveRemoteNotification:(NSDictionary
      )userInfo {
      [[NetCorePushTaskManager sharedInstance] didReceiveRemoteNotification:userInfo];
      }
      -(void)application:(UIApplication)application didReceiveLocalNotification:(UILocalNotification)notification {
      [[NetCorePushTaskManager sharedInstance] didReceiveLocalNotification:notification.userInfo];
      }
      Swift:
      func application( application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {
      NetCorePushTaskManager.sharedInstance().didReceiveRemoteNotification(userInfo)
      }
      func application(
      application: UIApplication, didReceive notification: UILocalNotification) {
      NetCorePushTaskManager.sharedInstance().didReceiveLocalNotification(notification.userInfo)
      }

  6. If app supports iOS version 10.0 or more

    Objective-C:
    -(void)userNotificationCenter:(UNUserNotificationCenter )center
    willPresentNotification:(UNNotification
    )notification withCompletionHandler:(nonnull void (^)(UNNotificationPresentationOptions))completionHandler{
    [[NetCorePushTaskManager sharedInstance] userNotificationWillPresentNotification:notification];
    }
    -(void)userNotificationCenter:(UNUserNotificationCenter )center
    didReceiveNotificationResponse:(UNNotificationResponse
    )response withCompletionHandler:(void(^)(void))completionHandler {
    [[NetCorePushTaskManager sharedInstance] userNotificationdidReceiveNotificationResponse:response];
    }
    Swift:
    extension AppDelegate : UNUserNotificationCenterDelegate {
    @available(iOS 10.0, )
    func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
    NetCorePushTaskManager.sharedInstance().userNotificationdidReceive(response)
    }
    @available(iOS 10.0,
    )
    func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
    NetCorePushTaskManager.sharedInstance().userNotificationWillPresent(notification)
    }
    }

  7. To login,

    Objective-C:
    [[NetCoreInstallation sharedInstance] netCorePushLogin:@"" Block:^(NSInteger statusCode) {}];
    Swift:
    NetCoreInstallation.sharedInstance().netCorePushLogin("") { (code) in }

  8. To logout,

    Objective-C:
    [[NetCoreInstallation sharedInstance] netCorePushLogout:^(NSInteger statusCode) {}];
    Swift:
    NetCoreInstallation.sharedInstance().netCorePushLogout { (code) in }

  9. For tracking events,

    Objective-C:
    [FIRAnalytics logEventWithName:@"" parameters:];
    Swift:
    Analytics.logEvent("", parameters: )

  10. Allowing push notifications,

    Go to Application target -> Capabilities -> Allow Push Notifications

Add Netcore SDK to your project

(Minimum required iOS version 8 or more)

Using CocoaPods

  1. Install CocoaPods on your computer.
  2. Create pod file using below command in project.
    pod init
  3. Add following line in your podfile.
    pod 'Netcore-Smartech-iOS-GTM-SDK'
  4. Run following command in your project directory.
    pod install
  5. Open App.xcworkspace and build.

Using Manual Integration:
Follow link for manual integration except activity tracking

For custom activity tracking through GTM panel:

  1. Create a New Tag under Tags Section of your GTM account and provide a name.
  2. Click on Tag Configuration and under Tag Type select Function Call.
  3. Provide NetCoreGTMTracking under classpath section.
  4. Expand ADD ARGUMENT section and provide key as event_name with value being the default built in Event Name Variable or define event name manually.
  5. Provide rest of the event attributes as arguments to function calls with appropriate data types.
    Ex. if value expected integer then i^product_id,
    if value expected string then s^product_name etc.
  6. Click on Triggering Section and choose your appropriate trigger on which this tag should fire.
  7. Submit this and publish it.
  8. Click on version and download GTM file and place it on your project under container folder (make sure the folder is of blue color).
    (if the folder does not exist then create one)

For building User Profile through GTM panel:

  1. Create a New Tag under Tags Section of your GTM account and provide a name.
  2. Click on Tag Configuration and under Tag Type select Function Call.
  3. Provide NetCoreGTMTracking under classpath section.
  4. Expand ADD ARGUMENT section and provide key as event_name with value profile_update.
  5. Provide rest of the event attributes as arguments to function calls.
    Ex. for name, key will be Name,
    for age, key will be Age etc.
  6. Click on Triggering Section and choose your appropriate trigger on which this tag should fire.
  7. Submit this and publish it.
  8. Click on version and download GTM file and place it on your project under container folder (make sure the folder is of blue color).
    (if the folder does not exist then create one)

Latest podspec

{
    "name": "Netcore-Smartech-iOS-GTM-SDK",
    "version": "1.0.0",
    "summary": "Smartech provides full stack marketing automation. SDK provides app engagement feature. These features are being used along with GTM.",
    "description": "Smartech provides full stack marketing automation. SDK provides app engagement feature. These features are being used along with GTM. A complete event tracking using Netcore Smartech iOS GTM SDK can be done to accurately monitor the flow of events and user interaction.",
    "homepage": "https://github.com/NetcoreSolutions/Smartech-ios-gtm-sdk",
    "license": {
        "type": "Commercial",
        "text": "https://github.com/NetcoreSolutions/Smartech-ios-gtm-sdk/LICENSE"
    },
    "authors": {
        "Netcore Smartech": "https://www.netcore.in"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source": {
        "git": "https://github.com/NetcoreSolutions/Smartech-ios-gtm-sdk.git",
        "tag": "v1.0.0"
    },
    "ios": {
        "frameworks": [
            "UIKit",
            "Foundation",
            "JavaScriptCore",
            "Security",
            "SystemConfiguration",
            "CoreLocation"
        ],
        "vendored_frameworks": "NetCorePush.framework"
    }
}

Pin It on Pinterest

Share This