Getting started with the iOS SDK

Convertedin SDK for events and push notifications is a powerful tool for developers to create engaging and personalized experiences for your app users. With this SDK, developers can easily track user behavior and send targeted push notifications to drive engagement and increase retention. Push notifications allow developers to reach users even when they're not actively using the app, keeping them up to date with the latest news, updates, and promotions. By leveraging Convertedin SDK for events and push notifications, developers can create more meaningful and impactful experiences for their users, leading to higher engagement, increased user satisfaction, and ultimately, greater success for their app.


Requirements

The Convertedin iOS SDK requires Xcode 10.1 or later and is compatible with apps targeting iOS 13 or above.

Installation

You can easily integrate Convertedin Mobile SDK into your projects using one of the following methods:

Method 1: Swift Package Manager

To integrate ConvertedinMobileSDK into your iOS project using Swift Package Manager, follow these simple steps:

  • Open Your Project: In Xcode

  • open your project workspace or project file where you want to add the framework.

  • Go to the "File" menu.

  • Select "Swift Packages."

  • Choose "Add Package Dependency..."

  • Enter the Repository URL:

 https://github.com/iOS-convertedin-eslamali/iOS_ConvertedinMobileSDK.git 
  • Click "Next & Finish"

  • Build and Run:

  • Xcode will automatically resolve and fetch the framework package.

  • Build and run your project to start using ConvertedinMobileSDK in your application

And that's it! You've successfully integrated ConvertedinMobileSDK into your project using Swift Package Manager. 🚀


Method 2: Cocoapods

To effortlessly integrate ConvertedinMobileSDK into your iOS project using CocoaPods, follow these straightforward steps: First you need to install cocaopods, Here's a comprehensive guide on how to install cocoapods Cocoapods documentation

After installing the Cocoapods successfully

  • Open the Podfile in a text editor and add the following line.

 pod 'ConvertedinMobileSDK'
  • Run the following command to install the framework and its dependencies:

pod install

You can now import and use ConvertedinMobileSDK in your iOS project. Xcode will handle the linking and configuration. And that's it! You've successfully integrated ConvertedinMobileSDK into your project using CocoaPods. 🚀


Getting Started

Step 1: Convertedin Mobile SDK Configuration

  • Open your app's AppDelegate.swift file.

  • Import ConvertedinMobileSDK at the top of AppDelegate.swift using the following line of code

 import ConvertedinMobileSDK
  • In the application(_:didFinishLaunchingWithOptions:) method, integrate our framework by adding the following code:

 ConvertedinMobileSDK.configure(pixelId: "Pixel_id", storeUrl: "store@test.com")

Make sure to set the pixelId and storeUrl as the appropriate initialization parameters for your use case. These parameters are crucial for configuring the SDK with your desired settings.


Step 2: Getting Notifications with Google Firebase Integration

To enable notifications in this framework, you need to integrate it with Google Firebase services. Firebase provides a robust platform for handling notifications, making it easy to send and receive messages in your application.

If you don't already have a Firebase project, create one and follow the easy steps on the Firebase Console.


Step 3: Receive Notifications For your app to make the best use of ConvertedinMobileSDK, it's essential to set up push notifications in the AppDelegate. Here's a comprehensive guide on how to Push Notification Push Notifications Documentation.

  • After Setup the Push Notification successfully, Implement the didReceiveRegistrationToken method in your AppDelegate.swift file to receive the FCM device token. This method is called when a new token is generated or an existing token is updated, with the following code

 func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
        if let fcmToken = fcmToken {
           ConvertedinMobileSDK.setFcmToken(token: fcmToken )
        }
    }

Step 4: Authenticate user by Sending user data

  • After successfully receiving a response from the login method or any other relevant action, you can use our ConvertedinMobileSDK's method to identify the user. Follow these steps to ensure user identification:

ConvertedinMobileSDK.identifyUser(email: "test@converted.in", countryCode: nil, phone: nil)

In this code snippet, you have the option to identify the user using either their email or phone number. Replace "test@converted.in" with the user's email address and provide the appropriate country code if you are identifying the user by phone number.


Step 5: Track user events and actions through your app.

ConvertedinMobileSDK offers a set of predefined events that are commonly used in most e-commerce applications. These predefined events include:

  • ViewContent: To track when a user views content, such as a product.

  • PageView: To track when a user views a specific page.

  • AddToCart: To track when a user adds an item to their cart.

  • InitiateCheckout: To track when a user initiates the checkout process.

  • Purchase: To track when a user completes a purchase.

You can use these predefined events to gather valuable data and insights about user interactions in your application effortlessly.

If the predefined events do not fully meet your tracking needs, don't worry! ConvertedinMobileSDK allows you to create your own custom events using unique identifiers. This flexibility enables you to tailor event tracking to the specific actions and interactions that matter most to your application.

By leveraging both predefined and custom events, you can gain a comprehensive understanding of user behavior and make data-driven decisions to enhance your e-commerce application.

you can use a predefined events with the following code:

ConvertedinMobileSDK.pageViewEvent()
ConvertedinMobileSDK.viewContentEvent()
ConvertedinMobileSDK.AddToCartEvent()
ConvertedinMobileSDK.InitiateCheckoutEvent()
ConvertedinMobileSDK.PurchaseEvent()

or you can create your custom events using the following code:

ConvertedinMobileSDK.addEvent()
  • Please, be mindful of methods that require parameters related to currency, total price, and a set of products. These parameters are crucial for accurate event tracking and analytics in your e-commerce application.


Step 6: Logging Out or Notification Cessation

  • If you want to stop geting our notification or when the user logout, call our ConvertedinMobileSDK's deleteDeviceToken method to unregister the device for notifications. This ensures that the user no longer receives notifications from your app.

ConvertedinMobileSDK.deleteDeviceToken()

Integrating Firebase for In-App Messages

step 1: Integrate with Firebase via Swift Package Manage

To enable Firebase In-App Messages in your application, it is recommended to install Firebase via a swift package manager. Follow the steps below to seamlessly integrate Firebase and create a new campaign with an in-app message:

  • Open Your Project: In Xcode

  • open your project workspace or project file where you want to add the framework.

  • Go to the "File" menu.

  • Select "Swift Packages."

  • Choose "Add Package Dependency"

  • Enter the Repository URL:

 https://github.com/firebase/firebase-ios-sdk.git 

step 2: Import Firebase in AppDelegate File and Configure

import Firebase

Inside the application(_:didFinishLaunchingWithOptions:) method, add the following code to configure Firebase:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 
    FirebaseApp.configure()
}

Step 3: Create a New In-App Message Campaign and Customize Style

Now that you have integrated Firebase In-App Messaging, you can create a new in-app message campaign and customize the style to deliver a personalized experience to your users.

  • Navigate to the Firebase Console.

  • Select your project.

  • In the left menu, click on "In-App Messaging."

  • Click on the "New Campaign" button.

  • Follow the on-screen instructions to set up your campaign, including targeting options, triggers, and scheduling.

Congratulations! By diligently following the steps outlined above, you have successfully integrated Firebase In-App Messaging into your iOS app. Your users are now ready to receive targeted and visually appealing in-app messages.

License

This project is licensed under the MIT License - see the LICENSE file for details.

in the Feedback rate the number 1: mean very bad rate the number 5: mean Excellent rate

Last updated