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 3 Current »

In-App Message

In-App Messages are notifications shown to your users when they are active directly in your mobile app. Add the following code right after the RelatedDigital.initialize method to enable the In-App Message feature.

RelatedDigital.inAppNotificationsEnabled = true                                       

After each customEvent call, it is checked for In-App Message. You can create and customize In-App Message on https://intelligence.relateddigital.com/#Target/TargetingAction/TAList page of RMC administration panel.

There are 12 different In-App Message designs available:

Pop-up - Image, Title, Text and Button

Mini - Icon and Text

Full Screen Image

Full Screen Image and Button

Pop-up - Image, Title, Text and Button

Pop-up Survey

Pop-up - NPS with Text and Button

Native Alert & Action Sheet

1-10 Rating NPS

Starred Survey & Second Popup

Half Screen Image

Carousel

Video

Drawer

If you want to manage the links you have added for inappler yourself, you can follow the step below.

First you have to call the delegate method.

RelatedDigital.inappButtonDelegate = self                                 

Then you can add the extension block and edit the code below according to you.

extension YOUR_VIEW_CONTROLLER: RDInappButtonDelegate {
    func didTapButton(_ notification: RDInAppNotification) {
        print("notification did tapped...")
        print(notification)
    }
}

Using In-App Custom Fonts

First, put the font you want to use in the In-App to the root directory of your project.

Then, you need to define the font you put in the root directory with its extension (.ttf or .otf) in Info.plist. Ex: Sydney.ttf

<key>UIAppFonts</key>
	<array>
		<string>FONT_NAME</string>
	</array>

Favorite Attribute Actions

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

RelatedDigital.getFavoriteAttributeActions { (response) in
            if let error = response.error {
                print(error)
            } else {
                if let favoriteBrands = response.favorites[.brand] {
                    for brand in favoriteBrands {
                        print(brand)
                    }
                }
                if let favoriteCategories = response.favorites[.category] {
                    for category in favoriteCategories {
                        print(category)
                    }
                }
            }
        }

If you want, you can access the features of the favorite feature action by specifying the ID of the Target Action.

RelatedDigital.getFavoriteAttributeActions(actionId: 188) { (response) in
            if let error = response.error {
                print(error)
            } else {
                if let favoriteBrands = response.favorites[.brand] {
                    for brand in favoriteBrands {
                        print(brand)
                    }
                }
                if let favoriteCategories = response.favorites[.category] {
                    for category in favoriteCategories {
                        print(category)
                    }
                }
            }
        }

Favorite Properties Action returns the following values as an enum.

public enum VisilabsFavoriteAttribute: String {
    case ageGroup
    case attr1
    case attr2
    case attr3
    case attr4
    case attr5
    case attr6
    case attr7
    case attr8
    case attr9
    case attr10
    case brand
    case category
    case color
    case gender
    case material
    case title
}

Story Manager

Story Banner and Story Action

Story Action allows you to add “Story” widgets within your app that can be viewed on iOS devices. The getStoryView method returns an instance of RDStoryHomeView, which is a subclass of UIView.

let storyView = RelatedDigital.getStoryView()
view.addSubview(storyView)

You can also summon a Story Action you want according to the Target Action ID.

let storyView = RelatedDigital.getStoryView(actionId: 67)
view.addSubview(storyView)

If you add a clickable URL, you can manage it with framework or direct deeplink to open in browser. However, in order to manage it on your own, you need to add the following code to the classes that comply with RDStoryURLDelegate.

extension YOUR_VIEW_CONTROLLER: RDStoryURLDelegate {
    func urlClicked(_ url: URL) {
        print("You can handle url as you like!")
    }
}

After this plugin, set the urlDelegate self.

let storyView = RelatedDigital.getStoryView(actionId: 67, urlDelegate: self)
view.addSubview(storyHomeView)

Clickable URL is not handled by SDK after adding RDStoryURLDelegate!

Mail Subscription Form

After creating the mail membership form from the RMC panel, as in the in-app message, each time you call a customEvent, it is checked whether there is a mail membership form or not, and then the mail membership form is displayed.

Spin To Win

After creating the Spin to Win from the RMC panel, as in the in-app message, each time you call a customEvent, it is checked whether there is a Spin to Win and then the Spin to Win is displayed.

Spin to Win Half Screen

Spin to Win Full Screen

Scratch To Win

After creating the Scratch to Win from the RMC panel, as in the in-app message, each time you call a customEvent, it is checked whether there is a Scratch to Win and then the Scratch to Win is displayed.

Gift Rain

After creating the Gift Rain from the RMC panel, as in the in-app message, each time you call a customEvent, it is checked whether there is a Gift Rain and then the Gift Rain is displayed.

Image from iOS (12) (1).mov

App Banner

To use the App Banner action, you first need to create and add a UIView in your application where you want it to appear. Then, you can call the getBannerView method to show banners within this UIView. Below, you can find an example of creating a UIView and displaying banners within it.

let bannerView = UIView()
        bannerView.translatesAutoresizingMaskIntoConstraints = false
        self.view.addSubview(bannerView)
        NSLayoutConstraint.activate([bannerView.topAnchor.constraint(equalTo: self.view.topAnchor,constant:  80),
                                     bannerView.heightAnchor.constraint(equalToConstant: 80),
                                     bannerView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
                                     bannerView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor)])
        bannerView.backgroundColor = .black
        
        
        var props = [String:String]()
        props["OM.inapptype"] = "banner_carousel"
        
        RelatedDigital.getBannerView(properties: props) { banner in
            if let banner = banner {
                banner.delegate = self
                banner.translatesAutoresizingMaskIntoConstraints = false
                bannerView.addSubview(banner)
                
                NSLayoutConstraint.activate([banner.topAnchor.constraint(equalTo: bannerView.topAnchor),
                                             banner.bottomAnchor.constraint(equalTo: bannerView.bottomAnchor),
                                             banner.leadingAnchor.constraint(equalTo: bannerView.leadingAnchor),
                                             banner.trailingAnchor.constraint(equalTo: bannerView.trailingAnchor)])
            }

        }

f you wish, you can send extra query parameters with the properties parameter. If you don't want to use it, you can change the properties parameter to properties: [String:String].

When your users perform a click action on the banner, deeplinks need to be handled and redirected by you. To do this, you can capture the URL using the RDInappButtonDelegate protocol. An example usage is as follows:

When your users click on the banner, the deeplinks should be handled and directed by you. For this, you must add BannerDelegate to the relevant class.

class ViewController: UIViewController, BannerDelegate

Then you can customize it by adding the following function.

func bannerItemClickListener(url: String) {
        print(url)
}

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. You must make sure that the product id is sent in these events.

Recommendation

Product recommendations are obtained by the SDK's recommend method. To get product recommendations you must pass 3 mandatory arguments which are zoneId, productCode and complete.

The RDProduct class looks after the following features:

Property

Type

code

String

title

String

img

String

dest_url

String

brand

String

price

Double

dprice

Double

cur

String

dcur

String

freeshipping

Bool

samedayshipping

Bool

rating

Int

comment

Int

discount

Double

attr1

String

attr2

String

attr3

String

attr4

String

attr5

String

If the suggested products are available for the arguments given in the Completion method, you must process the product array.

RelatedDigital.recommend(zoneID: "6", productCode: "pc", filters: []){ response in
    if let error = response.error {
        print(error)
    }else{
        print("Recommended Products")
        for product in response.products{
            print("product code: \(product.code) title: \(product.title)")
        }
    }
}

You can also pass a set of filters for the recommend method. For example, the following application will only return products that contain laptop in the title.

var filters = [RDRecommendationFilter]()
let filter = RDRecommendationFilter(attribute: .PRODUCTNAME, filterType: .like, value: "laptop")
filters.append(filter)
var properties = [String: String]()
properties["key"] = "value"
RelatedDigital.recommend(zoneID: "6", productCode: "pc", filters: filters, properties: properties){ response in
    if let error = response.error{
        print(error)
    }else{
        print("Widget Title: \(response.widgetTitle)")
        print("Recommended Products")
        for product in response.products{
            print("product code: \(product.code) title: \(product.title)")
        }
    }
}

Recommendation Click Reports

In order to display the reports on the panel after clicking on the products in the widget, you need to call the code below in the recommend method.

RelatedDigital.trackRecommendationClick(qs: product.qs)

  • No labels