AdHash-iOS
如何设置 AdHash
1. 安装 pod 'AdHash-iOS'
2. 将您的 UIView 配置为 AdHashView
3. 在 AppDelegate 文件中配置 AdHashManager
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let config = AdHashConfig(publisherID: "0x89c430444df3dc8329aba2c409770fa196b65d3c",
analyticsURL: "https://bidder.adhash.org/protocol.php?action=rtb_sdk",
bidderURL: "https://adhash.org/bidder/protocol.php?action=click",
publisherURL: "https://publisher.whatismycar.com/protocol.php?action=click",
reportURL: "https://google.com.ua",
apiVersion: 1.0)
AdHashManager.setConfig(config)
return true
}
4. 设置你的 ViewController
import UIKit
import AdHash_iOS
final class ViewController: UIViewController, AdHashViewDelegate {
@IBOutlet weak var banner: AdHashView!
override func viewDidLoad() {
super.viewDidLoad()
AdHashManager.bannerWidth = 300
AdHashManager.bannerHeight = 250
banner.adTagId = "AdID"
banner.delegate = self
}
func didClickOnAd(adId: String) {
print("Tapped on ad with bannerID: \(adId)")
}
func didClickOnReport(adId: String) {
print("Tapped on report with bannerID: \(adId)")
}
}
5. Enjoy ;)
所有可配置参数
属性名 |
类型 |
timeZone |
Int |
location |
String |
publisherID |
String |
screenWidth |
CGFloat |
screenHeight |
CGFloat |
platform |
String |
language |
String |
model |
String |
type |
String |
connection |
String |
isp |
String |
orientation |
String |
gps |
String |
bannerWidth |
CGFloat |
bannerHeight |
CGFloat |
blockedAdvertisers |
[String] |
currentTimestamp |
String |
recentAds |
[[Any]] |
apiVersion |
Float |
analyticsURL |
String |
analyticsScreenShotURL |
String |
bidderURL |
String |
publisherURL |
String |
reportURL |
String |
可用的代理方法
func didClickOnAd(adId: String)
func didClickOnReport(adId: String)