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.
SDK Integration
You can easily integrate Convertedin Mobile SDK into your projects using one of the following methods:
Method 1:
Using 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:
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.
Run the following command to install the framework and its dependencies:
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
In the application(_:didFinishLaunchingWithOptions:) method, integrate our framework by adding the following code:
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:
Authenticate user by Sending user data
The "Identify User" API in the ConvertedinMobileSDK allows developers to track and identify users across different devices and sessions. When a user logs in or creates an account, the developer can use the Identify User API to associate a unique identifier with that user.
This identifier can then be used to track the user's actions and behavior throughout their usage of the application. For example, if a user makes a purchase or completes a form, the Identify User API can associate that action with the user's unique identifier.
By using the Identify User API, developers can gain valuable insights into their user's behavior, preferences, and interests. This information can then be used to improve the user experience, personalize content, and increase user engagement and retention.
Additionally, the Identify User API can also be used to implement security measures such as authentication and authorization, by verifying that a user is who they claim to be and granting them access to certain features or content.
Overall, the Identify User API is a powerful tool for developers to understand and optimize their user's experience, as well as provide a more secure and personalized platform for their users.
This function is currently deprecated and will be removed in future versions. Please use the following methods instead:
Login()
: Use this for logging users into the system.
Register()
: Use this for new user registrations.
SetUserData()
: Use this to set or update user information.
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.
Register Action
Overview
This function is typically triggered when a user signs up for an account or registers their information. By tracking Register events, developers can gain insights into user acquisition and onboarding processes and optimize their registration flow accordingly.
Parameters
email
: The user's email address (required if registering by email).phone
: The user's phone number (required if registering by phone).
Example Usage
Note: Please replace the example email or phone number with real user data to successfully register the user.
Login Action
Overview
This function is typically triggered when a user login into your app. By tracking login action, developers can gain insights into user acquisition and onboarding processes and optimize their login flow accordingly.
Parameters
email
: The user's email address (required if logging by email).phone
: The user's phone number (required if logging by phone).
Example Usage
Note: Please replace the example email or phone number with real user data to successfully login the user.
SerUserData Action
Overview
This function is commonly used to set the current customer data, for example email or phone and should be used in the first screen of the app.
Parameters
email
: The user's email address (required if seting user email).phone
: The user's phone number (required if setting user phone).
Example Usage
Note: Please replace the example email or phone number with real user data to successfully register the user.
Step 3:
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:
or you can create your custom events using the following code:
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 4:
Configure Push Notifications
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.
Create a Firebase Project:
If you haven't already, create a Firebase project in the Firebase console.
Add your iOS app to the Firebase project by following the steps in the Firebase console.
Add the Firebase SDK to Your iOS App Using Swift Package Manager
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:
Select the following Firebase packages: (
FirebaseCore, FirebaseMessaging )
Click
Add Package
.
Configure Firebase in Your App:
Download the
GoogleService-Info.plist
file from the Firebase console.Add the
GoogleService-Info.plist
file to your Xcode project by dragging it into the project navigator.
Open your
AppDelegate.swift
and configure Firebase by adding the following code:
Open your app's AppDelegate.swift file.
Import Firebase at the top of AppDelegate.swift using the following line of code
In the application(_:didFinishLaunchingWithOptions:) method, integrate our framework by adding the following code:
Step 5:
Save Device Token
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
Step 6:
Pass Campaign ID
When a user clicks on a push notification, you need to pass the campaign ID to the SDK's
onPushNotificationClicked()
function. The campaign ID can be found in the payload of the push notification, typically under the key
"campaign_id"
.
Here's how to implement this:
Retrieve the Campaign ID: In the
userNotificationCenter(_:didReceive:withCompletionHandler:)
method, access theuserInfo
dictionary from the notification response.Pass the Campaign ID: If the campaign ID exists in the
userInfo
, pass it toonPushNotificationClicked()
.
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.
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:
step 2: Import Firebase in AppDelegate
File and Configure
Inside the application(_:didFinishLaunchingWithOptions:)
method, add the following code to configure Firebase:
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