1. Home
  2. Integrations
  3. iOS Native Events Setup Guide
  4. Social Applications – iOS

Social Applications – iOS

We have provided a list of Events with their example usage that can be integrated for Social Applications. Please find them below:

Note: Please ensure to include the MTraction header file (as shown below) in the class of your project from where the in App event methods have to be invoked.

#import <mTraction/MTraction.h>

1. Purchase Event

This is used to track the successful Purchase events or paid subscription to the Application.

You will need to call the below method to track the In-App Purchase event in your Application.

[[MTraction mTractionManager] trackPurchase:purchase];
// Product List Array Definition
NSMutableArray *productList=[[NSMutableArray alloc] init];

// Product Constructor Call
-(id)initWithProductIdentifier:(NSString*)identifier productName:(NSString*)productName price:(float)price quantity:(short)quantity;

  • Mandatory parameters (Product): 
    • Product Identifier – Unique Product Identifier
    • Product Name – Name of the Product
    • Price – Price of the Product
    • Quantity – Quantity of the Product being Purchased
  • Optional parameters (Product):
    • Brand – Brand Name of the Product
    • Product Discount – Discount applied for the Product
    • Category – Product Category
// Adding the product to the Product List
[productList addObject:product1];

// Purchase Constructor Call
-(void)trackPurchase:(Purchase*) purchase;

  • Mandatory parameters (Purchase): 
    • User Id – Unique User Identifier
    • Revenue – Total Revenue generated from this Purchase event
    • Payment ModeCREDIT_CARD or DEBIT_CARD or NET_BANKING or GIFT_CARD or PAYMENT_WALLET
    • Transaction Id – Unique Purchase Transaction Identifier
    • Purchase FrequencyONCE or RECURRING representing One Time Payment or Subscription based Payment respectively
    • Product List – Array of the list of products purchased
    • Locale – Currency code used for this event.

      NOTE: For passing custom currency code, Follow the sample below: 

      // For Custom Currency Code
      NSLocale *currencyCode = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"] ;
      
  • Optional parameters (Purchase):
    • Loyalty – Loyalty points applied on the Purchase
    • Overall Discount – Discount applied for the Purchase
    • Service Charge – Service Charge applied for the Purchase
    • Location – Geolocation of the Event

Sample Code

// Example Longitude & Latitude code (Long / Lat is optional)
#import <CoreLocation/CoreLocation.h>
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
  NSLog(@"didUpdateToLocation: %@", newLocation);
  CLLocation *currentLocation = newLocation;
  if (currentLocation != nil) 
  {
    double longitude = currentLocation.coordinate.longitude;
    double latitude = currentLocation.coordinate.latitude;
  }
}

// Default Currency Code from the local instance
NSLocale *currencyCode = [NSLocale currentLocale];

// Product List Array Definition
NSMutableArray *productList=[[NSMutableArray alloc] init];

// Example Product Constructor Call with the mandatory parameters
Product *product1 = [[Product alloc]initWithProductIdentifier:@"12345" productName:@"Yearly Subscription" price:14.99 quantity:1];

// Examples for other parameters passed for the Product Class (These are optional)
  [product1 setBrand:@"Premium Account"];
  [product1 setProductDiscount:5.00];
  [product1 setCategory:@"Social App"];

// Adding the product to the Product List
[productList addObject:product1];

// Example Purchase Constructor Call with the mandatory parameters
Purchase *purchase = [[Purchase alloc] initWithPurchaseUserId:@"123" revenue:14.99 currency:currencyCode transactionId:@"1000123" paymentMode:DEBIT_CARD frequencyMode:ONCE ProductList:productList];

// Examples for other parameters passed for the Purchase Class (These are optional)
  [purchase setLoyalty:350.00];
  [purchase setOverallDiscount:5.00];
  [purchase setServiceCharge:4.99];
  [purchase setLocationLatitude:latitude longitude:longitude];

// trackPurchase method call
[[MTraction mTractionManager] trackPurchase:purchase];

2. Paid Subscription Deactivated Event

This is used to track when the User has unsubscribed from any of the services of the Social Application.

You will need to call the below method to track the Subscription Deactivated event in your Application.

[[MTraction mTractionManager]trackPaidSubscriptionDeactivated:paidSubscriptionDeactivated];
-(void)trackPaidSubscriptionDeactivated:(PaidSubscriptionDeactivated*) paidSubscriptionDeactivated;

  • Mandatory parameters (Paid Subscription Deactivated): 
    • User Id – Unique User Identifier
  • Optional parameters (Paid Subscription Deactivated): 
    • Page Name – Page that triggered the Event
    • Location – Geolocation of the Event

Sample Code

// Example Longitude & Latitude code (Long / Lat is optional)
#import <CoreLocation/CoreLocation.h>
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
  NSLog(@"didUpdateToLocation: %@", newLocation);
  CLLocation *currentLocation = newLocation;
  if (currentLocation != nil) 
  {
    double longitude = currentLocation.coordinate.longitude;
    double latitude = currentLocation.coordinate.latitude;
  }
}

// Example Constructor call with User ID (User ID is mandatory)
PaidSubscriptionDeactivated *paidSubscriptionDeactivated = [[PaidSubscriptionDeactivated alloc]initWithPaidSubscriptionDeactivatedUserID:@"123"];

// Examples for other parameters passed with the event (These are optional)
  [paidSubscriptionDeactivated setPageName:@"My Account"];
  [paidSubscriptionDeactivated setLocationLatitude:latitude longitude:longitude];

// trackPaidSubscriptionDeactivated method call
[[MTraction mTractionManager]trackPaidSubscriptionDeactivated:paidSubscriptionDeactivated];

3. Profile Updated Event

This is used to track the event triggered when the user has updated his profile information on the Application.

You will need to call the below method to track the Profile Updation event in your Application.

[[MTraction mTractionManager]trackProfileUpdated:profileUpdated];
-(void)trackProfileUpdated:(ProfileUpdated*) profileUpdated;

  • Mandatory parameters (Profile Updated): 
    • User Id – Unique User Identifier
    • Category – Category/Section of the profile update
  • Optional parameters (Profile Updated):
    • Page Name – Page that triggered the Event
    • Location – Geolocation of the Event

Sample Code

// Example Longitude & Latitude code (Long / Lat is optional)
#import <CoreLocation/CoreLocation.h>
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
  NSLog(@"didUpdateToLocation: %@", newLocation);
  CLLocation *currentLocation = newLocation;
  if (currentLocation != nil) 
  {
    double longitude = currentLocation.coordinate.longitude;
    double latitude = currentLocation.coordinate.latitude;
  }
}

// Example Constructor call with the mandatory parameters
ProfileUpdated *profileUpdated = [[ProfileUpdated alloc]initWithProfileUpdatedUserID:@"123" Category:@"Personal Section"];

// Examples for other parameters passed with the event (These are optional)
 [profileUpdated setPageName:@"My Profile"];
 [profileUpdated setLocationLatitude:latitude longitude:longitude];

// trackProfileUpdated method call
[[MTraction mTractionManager]trackProfileUpdated:profileUpdated];

4. Friends Added Event

This is used to track the event triggered when the user has added a new friend to his list on the Application.

You will need to call the below method to track the Friends added event in your Application.

[[MTraction mTractionManager]trackFriendsAdded:friendsAdded];
-(void)trackFriendsAdded:(FriendsAdded*) friendsAdded;

  • Mandatory parameters (Friends Added): 
    • User Id – Unique User Identifier
  • Optional parameters (Friends Added):
    • GenderMALE or FEMALE based on the sex of the person, being added as a friend
    • Age – Age of the person being added
    • Pagename – Page that triggered the Event
    • Location – Geolocation of the Event
    • Description – Event Description

Sample Code

// Example Longitude & Latitude code (Long / Lat is optional)
#import <CoreLocation/CoreLocation.h>
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
  NSLog(@"didUpdateToLocation: %@", newLocation);
  CLLocation *currentLocation = newLocation;
  if (currentLocation != nil) 
  {
    double longitude = currentLocation.coordinate.longitude;
    double latitude = currentLocation.coordinate.latitude;
  }
}

// Example Constructor call with User ID (User ID is mandatory)
FriendsAdded *friendsAdded =[[FriendsAdded alloc]initWithFriendsAddedUserID:@"123"];

// Examples for other parameters passed with the event (These are optional)
  [friendsAdded setDescription:@"Friend request sent to id: 567"];
  [friendsAdded setGender:MALE];
  [friendsAdded setAge:27];
  [friendsAdded setPageName:@"Recommended Friends"];
  [friendsAdded setLocationLatitude:latitude longitude:longitude];

// trackPaidSubscriptionDeactivated method call
[[MTraction mTractionManager]trackFriendsAdded:friendsAdded];

5. Chatted Event

This is used to track the private or group chat event initiated by the user to other user(s) on the Application.

You will need to call the below method to track the Chatted event in your Application.

[[MTraction mTractionManager]trackChatted:chatted];
-(void)trackChatted:(Chatted*) chatted;

  • Mandatory parameters (Chatted): 
    • User Id From – Unique Identifier of the User who initiated the Chat
    • User Id To  – Unique Identifier of the User who received the Chat
  • Optional parameters (Chatted): 
    • Chat TypeDIRECT_CHAT or GROUP_CHAT
    • Page Name – Page that triggered the Event
    • Location – Geolocation of the Event

Sample Code

// Example Longitude & Latitude code (Long / Lat is optional)
#import <CoreLocation/CoreLocation.h>
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
  NSLog(@"didUpdateToLocation: %@", newLocation);
  CLLocation *currentLocation = newLocation;
  if (currentLocation != nil) 
  {
    double longitude = currentLocation.coordinate.longitude;
    double latitude = currentLocation.coordinate.latitude;
  }
}

// Example Constructor call with the mandatory parameters
Chatted *chatted =[[Chatted alloc]initWithChattedUserIDFrom:@"123" UserIDTo:@"567"];

// Examples for other parameters passed with the event (These are optional)
  [chatted setChatType:GROUP_CHAT];
  [chatted setPageName:@"Private Chat"];
  [chatted setLocationLatitude:latitude longitude:longitude];

// trackChatted method call
[[MTraction mTractionManager]trackChatted:chatted];

6. New Group Created Event

This is used to track the event triggered when an user has created a group in your Application.

You will need to call the below method to track the Group Created event in your Application.

[[MTraction mTractionManager]trackNewGroupCreated:newGroupCreated];
-(void)trackNewGroupCreated:(NewGroupCreated*) newGroupCreated;

  • Mandatory parameters (New Group Created): 
    • User Id – Unique User Identifier
  • Optional parameters (New Group Created): 
    • Quantity – Size of the Group created
    • Page Name – Page that triggered the Event
    • Location – Geolocation of the Event

Sample Code

// Example Longitude & Latitude code (Long / Lat is optional)
#import <CoreLocation/CoreLocation.h>
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
  NSLog(@"didUpdateToLocation: %@", newLocation);
  CLLocation *currentLocation = newLocation;
  if (currentLocation != nil) 
  {
    double longitude = currentLocation.coordinate.longitude;
    double latitude = currentLocation.coordinate.latitude;
  }
}

// Example Constructor call with User ID (User ID is mandatory)
NewGroupCreated *newGroupCreated = [[NewGroupCreated alloc]initWithNewGroupCreatedUserID:@"123"];);

// Examples for other parameters passed with the event (These are optional)
  [newGroupCreated setQuantity:50];
  [newGroupCreated setPageName:@"Create group"];
  [newGroupCreated setLocationLatitude:latitude longitude:longitude];

// trackNewGroupCreated method call
[[MTraction mTractionManager]trackNewGroupCreated:newGroupCreated];

7. Call Placed Event

This is used to track the call event initiated by an user to another user on the Application.

You will need to call the below method to track the Call Placed event in your Application.

[[MTraction mTractionManager]trackCallPlaced:callPlaced];
-(void)trackCallPlaced:(CallPlaced*) callPlaced;

  • Mandatory parameters (Call Placed Item): 
    • User Id From – Unique Identifier of the User who initiated the Call
    • User Id To – Unique Identifier of the User who received the Call
  • Optional parameters (Call Placed Item): 
    • Pagename – Page that triggered the Event
    • Location – Geolocation of the Event

Sample Code

// Example Longitude & Latitude code (Long / Lat is optional)
#import <CoreLocation/CoreLocation.h>
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
  NSLog(@"didUpdateToLocation: %@", newLocation);
  CLLocation *currentLocation = newLocation;
  if (currentLocation != nil) 
  {
    double longitude = currentLocation.coordinate.longitude;
    double latitude = currentLocation.coordinate.latitude;
  }
}

// Example Constructor call with the mandatory parameters
CallPlaced *callPlaced = [[CallPlaced alloc]initWithCallPlacedUserIDFrom:@"123456789" UserIDTo:@"87654321"];

// Examples for other parameters passed with the event (These are optional)
  [callPlaced setPageName:@"Contact List"];
  [callPlaced setLocationLatitude:latitude longitude:longitude];

// trackCallPlaced method call
[[MTraction mTractionManager]trackCallPlaced:callPlaced];
Was this article helpful to you? Yes No

How can we help?