使用 SDK
我已创建一个 APK 文件来调用所需的 API。
要求
- iOS 10.0+
- Xcode 11.4
安装
CocoaPods
您可以使用 CocoaPods 将 AkaInsights
添加到您的 Podfile
,以安装它
platform :ios, '10.0'
use_frameworks!
pod 'AkaInsights'
为了获取完整的功能,请在导入 UIKit 的任何地方导入 AkaInsights
import AkaInsights
使用示例
import AkaInsights
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
AkaInsights.events.InitialSource(request: AuthenRequest(client_id: "YOUR_CLIENT_ID", client_secret: "YOUR_CLIENT_SECRET"))
return true
}
您可以调用API
- AkaInsights.events.InitialSource...........
- AkaInsights.events.Registration...........
- AkaInsights.events.Purchase................
- AkaInsights.events.ItemPurchase.........
- AkaInsights.events.CartUpdate............
- AkaInsights.events.Checkout...............
- AkaInsights.events.ItemView................
- AkaInsights.events.CategoryView........
- AkaInsights.events.PageVisit..............
- AkaInsights.events.Campaign............
import AkaInsights
AkaInsights.events.Registration(request: RegistrationRequest(first_name: "your_first_name", last_name: "your_last_name", email: "your_email", phone: "your_phone", campaign_id: "your_campaign_id"))
AkaInsights.events.Purchase(request: PurchaseRequest(purchase_id: "your_purchase_id", purchase_status: "your_purchase_status", purchase_source_type: .none, purchase_source_name: "your_purchase_source_name", total_item: 1, product_ids: "your_product_ids", total_price: 0.0, total_price_without_tax: 0.0, total_price_local_currency: 0.0, local_currency: "your_local_currency", total_quantity: 1, payment_type: .online_payment, shipping_type: "your_shipping_type", shipping_company: "your_shipping_company", shipping_cost: 0.0, shipping_country: "your_shipping_country", shipping_city: "your_shipping_city", tax_value: "your_tax_value", voucher_code: "your_voucher_code", voucher_percentage: "your_voucher_percentage", voucher_value: "your_voucher_value", language: "your_language", location: "your_location", domain: "your_domain", user_id: "your_user_id", campaign_id: "your_campaign_id"))
AkaInsights.events.ItemPurchase(request: ItemPurchaseRequest(purchase_id: "your_purchase_id", purchase_status: "your_purchase_status", purchase_source_type: .none, product_id: "your_product_id", variant_id: "your_variant_id", title: "your_title", brand: "your_brand", category_id: "your_category_id", price: 0.0, price_local_currency: 0.0, discount_percentage: 0, discount_value: 0.0, original_price: 0.0, original_price_local_currency: 0.0, quantity: 0, total_price: 0.0, total_price_without_tax: 0.0, tags: "your_tags", category_1: "your_category_1", category_2: "your_category_2", category_3: "your_category_3", categories_path: "your_categories_path", categories_ids: [], language: "your_language", location: "your_location", domain: "your_domain", user_id: "your_user_id", campaign_id: "your_campaign_id"))
AkaInsights.events.CartUpdate(request: CartUpdateRequest(action: .add, button_copy: "your_button_copy", page_type: .none, product_id: "your_product_id", variant_id: "your_variant_id", title: "your_title", brand: "your_brand", price: 0.0, price_local_currency: 0.0, discount_percentage: 0, discount_value: 0.0, original_price: 0.0, product_list: [], product_ids: [], total_quantity: 0, total_price: 0.0, total_price_without_tax: 0.0, tags: "your_tags", category_1: "your_category_1", category_2: "your_category_2", category_3: "your_category_3", categories_path: "your_categories_path", category_id: "your_category_id", categories_ids: "your_categories_ids", language: "your_language", location: "your_location", domain: "your_domain", user_id: "your_user_id", campaign_id: "your_campaign_id"))
AkaInsights.events.Checkout(request: ChekoutRequest(step_number: "your_step_number", step_title: "your_step_title", product_list: [], product_ids: [], payment_type: .none, total_price: 0.0, total_price_without_tax: 0.0, total_quantity: 0, local_currency: "your_local_currency", tax_value: "your_tax_value", tax_percentage: "your_tax_percentage", shipping_type: .none, shipping_company: "your_shipping_company", shipping_cost: 0.0, shipping_country: "your_shipping_country", shipping_city: "your_shipping_city", voucher_code: "your_voucher_code", voucher_percentage: 0, voucher_value: "your_voucher_value", variant_list: [], variant_ids: [], language: "your_language", location: "your_location", domain: "your_domain", user_id: "your_user_id", campaign_id: "your_campaign_id"))
AkaInsights.events.ItemView(request: ItemViewRequest(product_id: "your_product_id", variant_id: "your_variant_id", title: "your_title", brand: "your_brand", price: 0.0, price_local_currency: 0.0, discount_percentage: 0, discount_value: 0.0, original_price: 0.0, stock_level: "your_stock_level", tags: "your_tags", category_1: "your_category_1", category_2: "your_category_2", category_3: "your_category_3", categories_path: "your_categories_path", category_id: "your_category_id", categories_ids: [], language: "your_language", location: "your_location", domain: "your_domain", user_id: "your_user_id", campaign_id: "your_campaign_id"))
AkaInsights.events.CategoryView(request: CategoryViewRequest(category_id: "your_category_id", category_name: "your_category_name", category_1: "your_category_1", category_2: "your_category_2", category_3: "your_category_3", categories_path: "your_categories_path", language: "your_language", location: "your_location", domain: "your_domain", user_id: "your_user_id", campaign_id: "your_campaign_id"))
AkaInsights.events.PageVisit(request: PageVisitRequest(referrer: "your_referrer", browser: "your_browser", location: "your_location", page_name: "your_page_name", user_id: "your_user_id", campaign_id: "your_campaign_id"))
AkaInsights.events.Campaign(request: CampaignRequest(status: .sent, code: "your_code", campaign_name: "your_campaign_name", campaign_id: "your_campaign_id", action_type: "your_action_type", action_name: "your_action_name", action_id: "your_action_id", campaign_policy: "your_campaign_policy", subject: "your_subject", language: "your_language", segment_id: "your_segment_id", user_id: "your_user_id"))
枚举类型
枚举类型 | 数据 |
---|---|
ActionEnum | ADD, REMOVE, EMPTY |
PageTypeEnum | PRODUCT, HOME_PAGE, CATEGORY, PAGE, CHECKOUT |
PaymentTypeEnum | BANK_TRANSFER, ONLINE_PAYMENT, CASH, COD |
PurchaseSourceTypeEnum | ONLINE, STORE |
ShippingTypeEnum | COURIER, NORMAL_DELIVERY |
StatusEnum | SENT, DELIVERED, CLICKED |
注意
您需要在AppDelegate中的func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {}调用API InitialSource
- 更新文件"Info.plist",添加一行
<string>Application wants to use your location</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Application wants to use your location</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
贡献
我们非常欢迎您为强AkaInsights