-
Notifications
You must be signed in to change notification settings - Fork 25
eToro
guillaumedebavelaere edited this page Oct 5, 2017
·
14 revisions
Update the SDK in your Podfile to ~> 1.1.9
TradeItSDK.theme = TradeItTheme.bb()
Remove button on the trade confirmation screen
TradeItSDK.isPortfolioEnabled = false
The country code should match ISO3166 alpha-2: http://dev.maxmind.com/geoip/legacy/codes/iso3166/
TradeItSDK.userCountryCode = "GB"
let order = TradeItFxOrder()
order.symbol = "USD/AUD"
TradeItSDK.launcher.launchFxTrading(fromViewController: self, withOrder: order)
TradeItSDK.welcomeScreenHeadlineText = "Put your headline text here"
We are using Google Analytics to track impressions on SDK screens. Rather than adding a dependency on the Google Analytics SDK, instead we're just going to use the Javascript version in a UIWebView
.
// Bloomberg Tracking Service test
@objc public class BloombergTrackingService: NSObject, AdService {
static let GA_ID = "UA-53437641-1"
public func populate(adContainer: UIView, rootViewController: UIViewController, pageType: TradeItAdPageType, position: TradeItAdPosition) {
self.populate(
adContainer: adContainer,
rootViewController: rootViewController,
pageType: pageType,
position: position,
broker: nil,
symbol: nil,
instrumentType: nil
)
}
public func populate(
adContainer: UIView,
rootViewController: UIViewController,
pageType: TradeItAdPageType,
position: TradeItAdPosition,
broker: String? = nil,
symbol: String? = nil,
instrumentType: String? = nil,
trackPageViewAsPageType: Bool = true
) {
// The pageType is classified based on ad targeting, but it will throw off tracking metrics.
// For instance we don't want to record a "trading" page view for every trading option selection screen they visit.
// So we default it to a "general" page view for those pages.
var trackingPageType = pageType
if !trackPageViewAsPageType { trackingPageType = .general }
guard let url = URL(
string: "https://www.tradingticket.com/widget/bloomberg/sdkTracker.html?pageType=\(TradeItAdPageType.labelFor(trackingPageType))&broker=\(broker ?? "")&symbol=\(symbol ?? "")&instrumentType=\(instrumentType ?? "")"
) else { return }
let webview = UIWebView()
let request = URLRequest(url: url)
webview.loadRequest(request)
adContainer.addSubview(webview)
guard let constraint = (adContainer.constraints.filter { $0.firstAttribute == .height }.first) else { return }
constraint.constant = 0
}
}
// Configure SDK to use the new service
TradeItSDK.adService = BloombergTrackingService()
For quote pages that display a TradeIt button to launch in to trading you can add a hidden UIWebView
pointing at:
https://www.tradingticket.com/widget/bloomberg/sdkTracker.html?pageType=quote/SYMBOL
Substitute in the symbol that the user is looking at to the string.