Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

In App Message

In-App Messages are notifications sent to your users when they are directly active in your mobile application.

Use the following method to show in-app messages and initialize the RMC:

Visilabs.CreateAPI("OrganizationID", "SiteID", "http://lgr.visilabs.net", "DataSource", "http://rt.visilabs.net" , "Android" , getApplicationContext(), "http://s.visilabs.net/json", "http://s.visilabs.net/actjson", requestTimeout);


Add the required getActivity() parameter to all customEvent() calls:

HashMap<String,String> parameters = new HashMap<String, String>();
 parameters.put("OM.exVisitorID", "test@visilabs.com");
 parameters.put("OM.sys.AppID", "visilabs"); //

 Visilabs.CallAPI().customEvent("android-visilab", parameters, getActivity());

The existence of a relevant in-app message for an event controlled by after each customEvent call. You can create and customize your in-app messages on https://intelligence.relateddigital.com/#Target/TargetingAction/TAList page of RMC administration panel.

There are 9 types of in-app messages:

Pop-up - Image, Header, Text & Button

Mini-icon&text

Full Screen-image

Full Screen-image&button

Pop-up - Image, Header, Text & Button

Pop-up-Survey

Pop-up - NPS with Text & Button

Native Alert & Action Sheet

NPS with Numbers

NPS & Second Popup

Video In-App

Favorite Attribute Actions

You can access favorite attributes of the Targeting Actions of type Favorite Attribute Action that you defined from the https://intelligence.relateddigital.com/#Target/TargetingAction/TAList/ section on the RMC panel via the mobile application as follows.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);


//requestAction() or requestActionId()
  try {
        VisilabsActionRequest visilabsActionRequest = Visilabs.CallAPI().requestAction(VisilabsConstant.FavoriteAttributeAction);
        visilabsActionRequest.executeAsyncAction(getVisilabsCallback());
    } catch (Exception e) {
        e.printStackTrace();
    }
    }

public VisilabsCallback getVisilabsCallback() {

    return new VisilabsCallback() {
        @Override
        public void success(VisilabsResponse response) {
            try {

                FavsResponse favsResponse = new Gson().fromJson(response.getRawResponse(), FavsResponse.class);

                String favBrands = favsResponse.getFavoriteAttributeAction()[0].getActiondata().getFavorites().getBrand()[0];
                Log.i("Favs 1.Brand", favBrands);

            } catch (Exception ex) {
                Log.e("Error", ex.getMessage(), ex);
            }
        }

        @Override
        public void fail(VisilabsResponse response) {
            Log.d("Error", response.getRawResponse());
        }
    };
}

Story Actions

Story Looking Banner ve Story Actions

Place the following VisilabsRecyclerView the desired section of the layout for the implementation of both actions.

    <com.visilabs.story.VisilabsRecyclerView
        android:id="@+id/vrv_story"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

After defining the VisilabsRecyclerView in your class, define the StoryItemClickListener and define the orientation or action you want to do when clicking each story. Toast Message is shown here for an example.

Then call the VisilabsRecyclerView's setStoryAction method and add the storyItemClickListener object to the method.

    VisilabsRecyclerView visilabsRecyclerView = findViewById(R.id.vrv_story);

       StoryItemClickListener storyItemClickListener = new StoryItemClickListener() {
            @Override
            public void storyItemClicked(String storyLink) {
                Toast.makeText(getApplicationContext(), storyLink, Toast.LENGTH_LONG).show();
            }
        };

       visilabsRecyclerView.setStoryAction(getApplicationContext(), storyItemClickListener);

 

You can also set it with Story Action Id.

visilabsRecyclerView.setStoryActionId(getApplicationContext(), "250", storyItemClickListener);

It will appear in your application as long as there is an active story looking banner or story on the panel.

Recommendation

Adding Recommendation Widgets in Mobile Application

You can find the documents required to show personalized product recommendations in your Android mobile application in this section.


Create a VisilabsTargetRequest object and call the executeAsync method of the VisilabsTargetRequest object.

ZoneID is different for each application, so contact RMC team for support. Suggestion widgets such as "Alternative Products" require the product code to be seen as a parameter.

After the request is completed, the callback function is called depending on the success or failure of the request, so you need to code the callback functions according to your needs as shown below:

VisilabsCallback callback = new VisilabsCallback() {
    @Override
    public void success(VisilabsResponse response) {
        try{
            JSONObject jsonObject = response.getJson();
            String groupTitle = jsonObject.getString("title");
            JSONArray jsonArray = jsonObject.getJSONArray("recommendations");
            for(int i = 0 ; i < jsonArray.length() ; i++) {
                JSONObject currentProductObject = jsonArray.getJSONObject(i);
                String currentProductTitle = currentProductObject.getString("title");
                Double currentProductPrice = currentProductObject.getDouble("price");
                boolean currentProductFreeShipping = currentProductObject.getBoolean("freeshipping");
                String qs = currentProductObject.getString("qs");
                //Continues like this...
            }
        } catch (Exception e){
            Log.e(LOG_TAG, e.getMessage(), e);
        }
    }
    @Override
    public void fail(VisilabsResponse response) {
        Log.e(LOG_TAG, response.getErrorMessage());
    }
};

After creating the callback function as above, the request is thrown as follows:

VisilabsTargetRequest targetRequest = Visilabs.CallAPI().buildTargetRequest(zoneID, "productCode");
targetRequest.executeAsync(callback);

There is also an overload buildTargetRequest method where you can pass filters and additional parameters.

List<VisilabsTargetFilter> filters = new ArrayList<VisilabsTargetFilter>();
HashMap<String,String> properties = new HashMap<String, String>();
properties.put("OM.extra", "Extra Value");
VisilabsTargetFilter f = new VisilabsTargetFilter("attr1", "0", "value");
filters.add(f);
f.setAttribute("attr2");
f.setFilterType("1"); // There are 2 filter types: Include and Exclude. For Include pass "0", for Exclude pass "1".
f.setValue("value");
filters.add(f);

try {
    VisilabsTargetRequest targetRequest = Visilabs.CallAPI().buildTargetRequest(zoneID, "productCode", properties, filters);
    targetRequest.executeAsync(callback);
} catch (Exception e) {
    e.printStackTrace();

In order for Recommendation clicks to be reflected on the panel, the following method should be called with the "qs" parameter of the clicked product.

// In the example callback function, you can see how the "qs" parameter can be obtained for each product.
Visilabs.CallAPI().trackRecommendationClick(qs);

Mail Subscription Form

After form is created at RMC panel, likewise in-app message, existence of mail subscription form is controlled by after each customEvent call. It is shown as follows. You need to call overload, which takes Activity in the customEvent parameter. Sample code and visual;

customEvent(String pageName, HashMap<String, String> properties, Activity parent)

Spin to Win

After form is created at RMC panel, likewise in-app message, existence of spin to win is controlled by after each customEvent call. It is shown as follows. You need to call overload, which takes Activity in the customEvent parameter. Sample code and visual;

customEvent(String pageName, HashMap<String, String> properties, Activity parent)

Spin to Win Full

Spin to Win Half

Scratch to Win

After form is created at RMC panel, likewise in-app message, existence of Scratch to Win is controlled by after each customEvent call. It is shown as follows. You need to call overload, which takes Activity in the customEvent parameter. Sample code and visual;

customEvent(String pageName, HashMap<String, String> properties, Activity parent)

Product Stat Notifier

The Product Stat Notifier action that you define in the RMC Panel works in Product View, Add to Cart and Add/Remove Favorites events. When you send these events, you must make sure that the product id is sent. The customEvent method you call in these events should take the Activity overload.

  • No labels