AppWords 1.1.1

AppWords 1.1.1

许可证 MIT
发布上次发布2017年6月

David Jacobson[Itamar]维护。



AppWords 1.1.1


需求

  • iOS 9.0+
  • Xcode 8.0+
  • Swift 3.0+

集成步骤

AppWords助手是什么?

AppWords助手是您的应用的AI助手。您可以使用SDK来学习用户习惯和行为,并在Deeplink门户中训练AI,以便提供链接到应用内部其他页面的有用结果。您向SDK提供目标页面的截图,命名它们并包括位置、关键词等,助手将根据您的需求学习如何正确响应用户操作。

在您助手的训练阶段,还有一个可选的卡片UI可以展示给用户。这些卡片将展示来自您的Deeplink账户的流行深度链接,因此当用户完成一个操作后,他们可以发送到应用内部其他流行且有趣的页面。


在您的应用中使用AppWords SDK

要从代码中访问SDK,您需要导入SDK头文件

import AppWordsSDK

初始化

在您开始使用AppWordsSDK之前,应该在您的App Delegate的application:didFinishLaunchingWithOptions:方法中调用initialize方法。

AppWordsSDK.shared.initialize(apiToken: "API_TOKEN", appId: "APP_ID") { error in

    if error == nil {
        print("AppWordsSDK - initialized")
    } else {
        print("AppWordsSDK - init failed: \(error?.localizedDescription)")
    }
}

查找您的API令牌和App ID

  1. 登录您的Deeplink账户https://portal.deeplink.me/publishers/sign_in .

  2. 点击用户图标。

  3. 点击"账户设置"。

  1. 在底部,您会找到您的API令牌。

  1. 至于App ID,请访问https://portal.deeplink.me/apps,并点击所选应用程序的编辑按钮。

  2. 在URL栏中,您可以在URL字符串中找到App ID,例如 https://portal.deeplink.me/apps/[APP_ID]/edit

注意

  • 完成处理程序将在主线程上调用。

  • API_KEY是唯一开发人员ID,您在注册Deeplink账户时分配给您。《APP_ID》是唯一的应用ID,在创建新应用时分配给该应用。

  • 通过此方法检查 API_KEYAPP_ID,并允许您向服务器发送 Intent。

  • 可以通过 isInitialized 属性始终检查 SDK 的状态。

创建 Intent

Intents 是用户在您的应用程序内部刚刚完成的行为。例如,如果您有一个旅行应用程序,并且一个用户刚刚购买了机票,那么 intent 可以命名为 Booked FlightBought Plane Ticket。在您的应用程序中保持同一操作具有相同的 intent 名称是一种良好的实践,这可以使训练您的 AI 助手变得更加容易,并且保持一致性。

要创建并发送 Intent 到服务器,您应该调用 createIntent(type, view, viewName, location, keywords, completion) 方法。

AppWordsSDK.shared.createIntent(type: “flight”, view: self.view, viewName: “Flight Purchase Confirmation“, location: "New York City", keywords: [“Jet Blue“], completion: { (error, intent) -> Void in

    if let createdIntent = intent {
        print("The Intent was created - \(createdIntent)")
    }

})

注意

  • 在调用此方法之前,需要初始化 SDK。

  • type 参数是 Intent 的名称。即:“flight”

  • view 参数指的是将被保存为图像并发送到服务器的视图。它可以将值设置为 nil,这将导致软件抓取整个屏幕的截图。您可以传递从 UIView 类继承的任何对象。该方法允许您将视图层次结构绘制到图像中。

  • viewName 参数是视图截图的名称。

  • 如果 Intent 有位置数据,应使用 location 参数;城市、国家或邮政编码。

  • keywords 参数用于添加任何元数据到 Intent。任何您认为对助手有用的数据。

  • completion 参数是创建 Intent 后执行的块。这个块没有返回值,接受两个参数。第一个参数指示如果发生错误,第二个是一个创建的 Intent。

训练您的助手

您可以从 Deeplink 门户内部进行助手的训练。门户页面即将上线,请关注 https://portal.deeplink.me/appwords

显示 Cards UI

在助手进行训练时,您可以向您的用户显示功能图卡的 UI,突出显示您的应用程序中的热门深链接。虽然这还不是完整的助手结果(因此是可选的 UI),但您仍然可以使用这些图卡来帮助应用再循环和增加应用会话时间。

Deeplink 门户内需执行的步骤

应用内(Xcode)需要执行的步骤

    1. 打开您使用 AppWords 库的项目。
    1. 转到 Main.storyboard 并将 AppWordsButton 添加到视图中。

    1. 打开特定的 ViewController 并添加下面的属性和方法。
import UIKit
import AppWordsSDK

class ViewController: UIViewController {

    @IBOutlet weak var appWordsButton: UIButton!

    var createdIntent: Intent?

    @IBAction func appWordsButtonTapped() {

    }
}
    1. 在 Main.storyboard 中创建按钮和视图控制器属性之间的连接。
    1. 向 viewDidLoad 方法中添加代码,这将创建一个新的 Intent 并将其发送到服务器。您将从服务器收到的响应中接收创建的 Intent,它将包含您应用程序中最热门的深链接列表。如果该列表不为空,则可以显示 AppWordsButton。
override func viewDidLoad() {

    appWordsButton.isHidden = true

    AppWordsSDK.shared.createIntent(type: "tickets", view: self.view, viewName: "Bought Movie Ticket", location: "New York City Upper West Side", keywords: ["Captain America"]) { error, intent in

        self.createdIntent = intent

        if let links = intent?.topDeepLinks, links.count > 0 {
            self.appWordsButton.isHidden = false
        }
    }
}
    1. 当按钮被点击时,显示包含创建的 Intent 所有结果的 AppWordsViewController。
@IBAction func appWordsButtonTapped() {

    if let intent = createdIntent {
        AppWordsSDK.shared.presentAppWordsViewController(intent: intent, inViewController: self)
    }
}

Facebook Messenger 集成

现在您可以为AppWords Fb Messenger机器人添加一个按钮,将您的用户链接到应用。机器人将向您的用户发送返回应用的深度链接,这样您就有另一个可以重新吸引用户并增加用户在应用中花费时间的场所。

说明

  • 将'MessengerButton'添加到一个视图中,并在按钮被点击时调用'AppWordsSDK.shared.presentMessengerCardViewController(inViewController: self, message: nil, buttonTitle: nil)'方法。
  • 您可以选择传递参数,例如消息和按钮标题。这些值将在消息卡片视图中可见。

就这么简单!

AppWordsSDK 1.1.1有什么新功能?

AppWords 1.1.1有什么新功能?

  1. Facebook messenger整合!现在您可以通过AppWords Facebook messenger机器人吸引用户。在发布您的结果卡片之前,您可以在fb messenger中开始测试结果,并根据用户在应用中执行的动作/意图将用户深度链接回您的应用。

如果您有任何其他问题,请与我们联系!

[email protected]