The Perksly iOS SDK makes it quick and easy to monetize URL taps in your iOS app
Perksly iOS SDK
The Perksly iOS SDK makes it quick and easy to monetize URL taps in your iOS app. Our SDK helps you add commissionable affiliate links to your iOS apps in minutes. It captures existing URLs and converts them to affiliate links so you can earn every time a user taps a link.
Earn up to 10% commissions from 5,000+ popular brands like Skims, Ulta Beauty, Walmart, Macy’s, Nordstrom, Bloomingdale’s, Madewell, Alo Yoga, Bonobos, Adidas, and more.
Get started by creating a ? Perksly SDK Key and view our ? integration examples below.
Features
A few of the things you can do with Perksly:
- Automatically create affiliate links and redirect users when they tap a link
- Open links natively within your app or in the Safari app (to enable browser cookies)
- Track unique links for users
- View clicks, sales, and commissions
- Leverage the Perksly Developer API
Requirements
The Perksly iOS SDK requires Xcode 13.2.1 or later and is compatible with apps targeting iOS 13 or above.
Installation
Perksly for iOS supports iOS 13+. Xcode 14 is required to build Perksly iOS SDK.
Swift Package Manager
Add https://github.com/knoxdobbins/perksly
as a Swift Package Repository in Xcode and follow the instructions to add Perksly
as a Swift Package.
Usage
Import the SDK in your code:
import Perksly
Set your public SDK Key (pk_live
) and the clientID
linked to your developer account in AppDelegate.swift
:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
...
Perksly.clientID = "pk_live_5aT6ia9..."
Perksly.sdkKey = "2a8c173b-..."
...
return true
}
(Optional) Provide an externalUID
to track link taps for specific users:
Perksly.externalUID = "user-418a9..."
Auto Create & Open Link on Tap
Then, use openLink
to present a SFSafariViewController (natively within your app) with Perksly when a user taps a link:
Perksly.openLink(from: self, urlString: "https://www.aloyoga.com/products/m1205r-conquer-reform-crewneck-short-sleeve-dark-heather-grey")
Optionally, you can use openSafariLink
to open the link on the device’s Safari app to enable browser cookies and improve tracking:
Perksly.openSafariLink(from: self, urlString: "https://www.aloyoga.com/products/b1013f-alo-lasting-lip-balm-alo-scent")
OR, Create a Link to use however you’d like (createLink
function does not present a view)
Perksly.createLink(urlString: "https://www.aloyoga.com") { PerkslyLink, PerkslyError in
if let link = PerkslyLink {
//Do whatever you'd like with this link
print(link)
}
}
Example
Use openSafariLink
or openLink
to open URLs when users tap a link or touch a button:
import Perksly
override func viewDidLoad() {
super.viewDidLoad()
...
//(Optional) Provide an `externalUID` to track link taps for specific users:
Perksly.externalUID = "user-418a9..."
...
}
func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange) -> Bool {
//Open link in device's Safari app (sets cookie on device Safari which leads to better performance, more tracking)
Perksly.openSafariLink(from: self, urlString: URL.absoluteString)
return false
}
func onTouchUpInsideTheLinkButton(url: URL) {
//Open link inside the app in SFSafariViewController
Perksly.openLink(from: self, urlString: url.absoluteString)
}
Feedback
Feel free to send us feedback on Instagram or file an issue. Feature requests are always welcome.
If there’s anything you’d like to chat about, please feel free to email Knox at knox@perks.ly!