HomeAppVirality DocsAdvanced ConfigurationsConfiguring custom social channel

Configuring custom social channel

AppVirality provides 12 common social sharing channels which customers can use to invite their friends. AppVirality tracks the user actions on these common social channels and provides analytics such as Number of Invites, Clicks and installs occurred through these social channels.

If you wish to track analytics for additional social channels which are not part of common social channels listed on AV dashboard, you can add those social channels from AppVirality Dashboard.

You can add custom social channel by Navigating to the “Social Channel Selection” while creating/editing the campaign. Click on “Show More” to expand the “Social Channel Section” and click on “Custom” social channel icon with symbol “+” . Enter all the required fields in the “Configure custom social action” and save.

Important fields while adding custom social channel:

Social action name – Name of the social action(Not Shown to App Users). It is required while you are configuring this social channel during AppVirality SDK integration. This name will be used to identify social channel in analytics on AV dashboard.

Display name- It will be shown to the users while inviting their friends in the share intent screen.

 

After adding the social channel on AppVirality Dashboard, you need to configure AppVirality SDK to display the custom social channels.There are two ways to configure a custom social action, the first one is to add an installed app(app with package name and sharable intent) which is not available in the common social actions on dashboard, while the other is to add a social action which is not an app and will have its own custom implementation. Below is a detail description of both of them.


If you want to allow users to invite their friends through an App which is having sharable intent, add a custom social action on AV dashboard(as described above) and configure AV SDK by supplying the App package name and sharable intent class name. Provided sharable intent will be invoked when a user click on social channel. Social channel will be shown to users only if the App is available on the device.

For this, you will have to configure it in your app using the Config class while instantiating the AppVirality SDK, passing the Config class instance in the getInstance(Context context, Config config) method of the AppVirality class. AppVirality SDK creates its singleton to be used throughout a session, so please make sure to pass the Config class instance when you instantiate the SDK for the first time, otherwise it would get ignored if the SDK is already instantiated. The best way to instantiate the SDK is in the Application class. Please refer the below code for the same.

 

package com.appvirality.appviralitytest;

import android.app.Application;

import com.appvirality.AppVirality;
import com.appvirality.Config;

public class AppViralityTestApplication extends Application {

    AppVirality appVirality;
    static boolean isDisplayingActivity;

    @Override
    public void onCreate() {
        super.onCreate();

        Config config = new Config();
        config.setCustomSocialActionData("custom_social_action_1_name", "custom_social_action_1_package_name", "custom_social_action_1_class_name", false, 0);
        //Example: Adding Installed App as custom social action
        //config.setCustomSocialActionData("Buffer", "org.buffer.android", null, false, 0);
        //adding custom(Non-Installed) social action with custom implementation
        //config.setCustomSocialActionData("Invite Contacts", null, null, true, R.drawable.invite_contacts);
        appVirality = AppVirality.getInstance(this, config);
    }

}

As you could see in the above code block you can add multiple custom social actions using the setCustomSocialActionData(String socialActionName, String packageName, String className, boolean isCustomImpl, int iconId) method of the Config class. Its parameters description is as follows:

Input Params
Input Params Description
socialActionName
String
This must be same as the name with which you have created the custom social action on dashboard.
packageName
String
This is the package name of the app as displayed on its Google Play Store page in the search bar.
className
String
This is the fully qualified name of the class which you want to be launched for sharing the invite message. You need to pass this parameter only if the app you are adding provides multiple components for text sharing and you want some particular one(s) of them to be used for sharing else pass it as null to show all text sharing intents.
isCustomImpl
boolean
Set this as True if you are adding a social action with custom implementation else set False for app based custom social action.
iconId
int
Pass here the resource identifier for the icon which you want to be shown for a custom implementation social action. If adding an app based social action pass it as 0.

This is mainly for when you want to have some custom social action which is not available as an app on Google Play Store. Lets say you may want to use some of your APIs for sending invite using user’s Email or Phone No, for this you can add a new custom social action on dashboard and set the its data using setCustomSocialActionData() method as shown in the above step. Once done, this new social action will start showing up on the Referral screen. As it is meant to have a custom implementation, you will have to handle its click event and provide its implementation in the invokeCustomInvite() method of the ReferFragment class in the AppViralityUI module.

 

/**
 * You will find the below method i ReferFragment class in AppViralityUI module
 */
private void invokeCustomInvite(SocialItem socialItem, SocialAction socialAction) {
    switch (socialItem.appname) {
        case "custom_social_action_1":
            /**
             * Do your custom social action implementation here. Don't
             * forget to invoke appVirality.recordSocialAction() method
             * for recording the invite sent.
             **/
            break;
    }
    appVirality.recordSocialAction(socialItem.socialActionId, Constants.GrowthHackType.Word_of_Mouth, womCampaignDetail.shortCode, constructShareMsg(socialAction));
}

 

Was this article helpful to you? Yes No