Video hosted by Apple at devstreaming-cdn.apple.com

Configure player

Close

WWDC Index does not host video files

If you have access to video files, you can configure a URL pattern to be used in a video player.

URL pattern

preview

Use any of these variables in your URL pattern, the pattern is stored in your browsers' local storage.

$id
ID of session: wwdc2014-301
$eventId
ID of event: wwdc2014
$eventContentId
ID of session without event part: 301
$eventShortId
Shortened ID of event: wwdc14
$year
Year of session: 2014
$extension
Extension of original filename: mov
$filenameAlmostEvery
Filename from "(Almost) Every..." gist: [2014] [Session 301] Affiliate T...

WWDC14 • Session 301

Affiliate Tools for App Developers

Services • iOS, OS X • 58:21

Earn commission while linking to iTunes music, apps, books, and more. Get an overview of the new global iTunes Affiliate Program and see how simple it is to get started linking to iTunes content using iOS APIs and SmartApp Banners, creating iTunes Radio stations, and much more.

Speakers: Mark Miller, Rick Rubenstein

Unlisted on Apple Developer site

Transcript

This transcript has potential transcription errors. We are working on an improved version.

All right. Good morning everyone. Welcome to this morning's session. My name is Mark Miller. I'm an iTunes Engineering Manager on the store, and we're going to be talking about "Affiliate Tools for App Developers." Now, just in case anybody is new to the program, or unfamiliar with what it's for, we're going to go over a quick overview of how it works, what its purpose is and how you can use it.

It's also been a couple years since we've last presented here, so we'll talk about what's new in the program and what new things you can do with it. And finally, there's going to be a deep dive on tools and services that you can use to interact with the program.

So first off, we kind of need a cast of characters. Who's involved with the affiliate program and how do they interact with each other? As you might guess, they are the customer, yours, and the iTunes Stores, and they are talking to you and talking to the iTunes Store, but what might not be so obvious is behind the scenes, there's an affiliate network. And the affiliate network mediates the interaction between you and the store. And the affiliate network is where you go to sign up, set up payments, manage and track your campaign performance and go to check on any support issues you have.

So what's it for? The key thing that you're trying to do with the affiliate program is to drive customers to your apps and other content. So you might have a game, and perhaps you've released a sequel to it. You want to promote that app, and you can do that using the affiliate program. Similarly, you might already have a website used to promote your apps, and you can affiliate those links and start getting the benefits of the affiliate program that way.

But it doesn't have to be your own apps that you're promoting. You can promote other app developers' apps and other content, and this is pretty much all of the content on the Music Store - excuse me, on the store. So that's music, movies, TV shows, books, podcasts, anything you can think of is supported by the program.

And the Use Case here is - there's pretty much - there's a wide Use Case for what you can do with it. You might have a soundtrack that's related to your game, and you can promote that. Or if you're a productivity app, and there's a similar app that works well with it, you can promote that from within the app or on your website.

Most of all, you are trying to connect your users with content that they're going to want to download. They're - you're interrupting their workflow a little bit to send them to the store, so make sure it counts. Make sure that link is relevant to what they're interested in and something that they're going to want to buy.

Now, the key to the program is that all of your links need a little bit of data on them to function correctly. So you add a bit of affiliate data to an existing iTunes Store link, and that's it. You're ready to go with the affiliate program. In return for marketing and promoting the iTunes and App Stores, you earn a commission on sales generated from that referral.

For you, you get the benefit of tracking the effectiveness of your marketing with our tools. And best of all, this works on both web and in your app, so there's no reason to limit the usage of the affiliate program to the web. You can also do it within your app.

Now, under the covers, those links are going to be clicked on or tapped on in iOS, and the data from the URL is going to be copied into a cookie, and that cookie lives for 24 hours on the user's device. And it's important that you realize that the data is tracking the cookie and not somewhere on the server.

This means that if the user clicks on one of your links and then moves to her iPhone or iPad to continue browsing the store, that any purchase made on the device will not credit to you. So it's the same device that the tap happens on and the purchase. Now, once the purchase happens, the data is copied into the database and the database is synced to the affiliate network, and that's how you get paid.

Now the terms are really great. You earn 7 percent commission on all sales. That means that if you link to, for example, an app, and the user winds up buying another app, you get credited. If the user actually leaves the App Store and goes to buy something on the Music Store, you also get credited. And it's 7 percent for all sales within 24 hours.

Now this is kind of important. It's a case of last one wins. You are operating in an ecosystem of a lot of other developers, and it's whoever is the most recent referral gets the credit for the sale. So if some - if a user taps on your link and then three hours later taps on another link from another affiliate, that affiliate gets credited for the next 24 hours' worth of sales.

Now best of all, this is a seamless experience from the point of view of your users. An affiliate link looks and acts just like a regular iTunes Store link. So here, we've got an example of "Cut the Rope," and they're promoting the sequel to their app, "Cut the Rope 2." So when the user taps on Get it Now, an affiliate link, everything acts just as you expect. The store carousels in, and they can preview, buy, look at reviews, look at screenshots and browse the store.

And again, after they've clicked this, it's not just apps that are credited to that affiliate. It's music, movies, TV shows, all of it. So that's the affiliate program in a nutshell. Let's talk about what's happened in the past couple years. Most importantly, we have had a massive territory expansion.

This was the state of the world, or at least the affiliate world in 2012. We were on three continents, and we had program support in 45 countries. Since then, we have introduced the affiliate program to 147 countries. That's a 3X expansion, and 50 of those countries happened in 2014 alone.

Now, that's pretty great. You're promoting your apps and other content worldwide with the affiliate program, but best of all, you only need one network to work in the entire world. If you're familiar with the program from a couple years ago, you had to sign up with one program to work in the Americas, a second program to work in Europe, and a third program to work in Australia and New Zealand. Nowadays, one network gets you worldwide access to 147 countries. This is really huge.

Now that means one sign up, one payment set up, all your tax information, all that sort of financial transaction stuff that you need to get started with the program, you do that once and you're working across the globe. Even better, we have a common link structure for the entire world. Now this is what a normal, unaffiliated iTunes Store link looks like. You can see that it's in the U.S. storefront. It's an app called "iMovie" and there's the iTunes Store content ID at the end.

It used to be that if you wanted to add affiliate data to this URL, you would end up with something like these two options, and you would have to do it in a region specific manner. So the URL on top was for the Americas. The URL on the bottom was for Europe. These URL's are messy. They're confusing.

They're even suspicious. If a user were to look at the link that you're calling an iTunes link and examine it a little more closely, they would say, "Oh, I'm, this is, I'm not sure what I'm clicking on anymore." They might be turned away by that. So no more of that. Nowadays, we take an existing store link and we add just a small bit of data and the host is still the same: iTunes.apple.com.

So what we're adding here to the base URL is a small bit of affiliate data. The first part of that is the AT Query parameter. This stands for affiliate token, and the value is essentially your user ID within the affiliate program. This is how we identify you, and this is how you get credited for purchases made after a user taps on your link. So it's very important to get this one right. Also, in the affiliate data, is the CT Query parameter, and CT stands for campaign token.

And this is an optional query parameter so you don't have to put it on, but you can do a lot of really important things with it. If you have a campaign that you want to track separately from the rest of your marketing efforts, you can use this campaign, and it will show up differently in our UIs.

So for example, you might have a campaign for your website. You might have a campaign, a separate campaign for the interior pages of your website. You could have campaigns for each email blast that you send out. If you're doing online advertising and you're buying keywords, you can have a campaign for each of those. You could have campaigns for links within your apps. You can do a lot of analysis to find out what works and what doesn't with your marketing efforts.

Now it's important to note one thing about these URLs. I said that there's one link structure worldwide, but content is not necessarily available around the world. The situation for apps is pretty easy. Most apps are available in every country. But if you're linking to music or movies or books, the rights may not carry over from one storefront to another, so you need to, if you're trying to send your user to a particular piece of content, it's best to check if it's available in their storefront before you present them with that link.

Another common mistake that you make when first interacting with the program is getting your query strings wrong. The URLs are fairly simple, but there's a few gotcha's that you need to avoid. The first thing to make sure of is to identify if there's already query string on the URL.

Now the query string, the start of the query string is identified by the question mark, and if there's no question mark, and you blindly append your affiliate data using ampersand, that URL probably won't even load for your user. They're just going to have an error, so don't do that. What you want to do is check for the question mark, and if it's not present on the string, add the question mark and then your affiliate data.

Now the reverse is also a gotcha, and this is just as important. If there's already a question mark in the URL, that means that there's an existing query string. You need to use the ampersand as a delimiter instead of using another question mark. If you click on - if a user clicks on a URL with two question marks in it, it's not going to parse correctly and you're not going to be credited with the referral. So the key thing is look for the question mark, and if it's already there, use ampersand to attach your affiliate data.

Now I mentioned one network. One of the key benefits of having one network worldwide is that you can have a global unified view of how your marketing is going. Now this is a dashboard that shows you in real time who's clicking and what, what links they're clicking on - excuse me, not who's clicking but the type of links that they're clicking on.

So the first thing you'll notice about this UI is that you can track clicks over time and you can zoom in from a year's worth of data all the way down to a day. And again, these graphs are updating in near real time. So in this case, we're looking at the month-over-month view, and our current month is plotted in orange against the previous months' performance. So you can see if your graph is trending down or if it's different compared month over month, and adjust your marketing campaign accordingly.

Also of note is that the conversion rate is mentioned here, and you should pay close attention to this value. If the conversion rate starts diving, that might represent a problem with your marketing efforts. Maybe your URLs are not really exciting users into buying, or maybe there's a problem with your links and something needs investigating. So keep an eye on that one.

Also on the global dashboard, you can zoom in and get a per country view of things. The - if you're operating in more than one country, you can see how well you're doing in the U.S. as opposed to the UK, or in South America or wherever. Also, if you are promoting more than one type of content - so for example, apps and books or movies and music - you can slice and dice and get reports on how each one of those is performing. So there's a lot of rich data here.

And furthermore, there's more utility up at the top. You can see additional tools for interacting with the program. You can get more in-depth reports of what's going on. You can manage your payments and other settings. So make sure to check out all the options that this provides because it's a great way to actually see how you're doing with your marketing efforts. So that's the Global Dashboard.

It's a single, unified view of a single network that's operating in 147 countries. I can't tell you how excited I am about the fact that we have one network that lets you operate worldwide. It's a huge simplification of what we used to have to do, so very exciting.

Hopefully, at this point you are similarly excited. You want to - you're ready to go. Go sign up with your program, and you want to know how next to - what the next steps are in terms of integrating. So for that, we've got a Tools and Services section.

We're going to start talking about simple tools to get you started quickly. These are things that you don't need a computer science degree to work with. It's maybe just a matter of creating a couple links and adding them to an email or to your website or somewhere in your app. These tools are really great for the one-offs, the manual sort of set up. There's also more advanced tools.

So if you want to find what's going on really in the now on the store, and promote that sort of content, these tools will let you do that. We also provide Smart App Banners. Smart App Banners allow you to promote your app from your websites in a very seamless way. There's a lot of power there, and in the right situation, can be very, very useful.

The StoreKit Product Sheet and iTunes Radio have been recently added to the program, and we'll talk about how to work with those and how to get the most out of that. And finally, we'll finish with the Collection feature that allows you to define dynamic playlists for the store. This can be really useful for customizing content for your users.

Let's get started with the simple stuff. The simplest of all is Link Maker. This is a simple search box where you can come in and type a search term, get results and get links. Especially if you click into Link Maker from within the affiliate network, your URL that you come in with is going to have all your affiliate data pre-populated so you don't need to worry about adding the affiliate data to the URL itself. You don't need to worry about question marks and ampersands and URL encodings. It's all dramatically easier.

So in this case, we're going to do a search for Ed Sheeran. He's a UK singer/songwriter with a lot of awesome great songs, and we can see that his albums are available in the research results, and by tapping on one of these search results, we get a nice pop up of HTML that we can drop right into a web page.

Not only that, this HTML has a number of different options for the formatting. So this is the small format for the Badge. If you prefer a large Badge, we've got HTML to do that. Similarly, if you just want to have a raw text link, maybe this is for an HTML email blast or something like that, you've got the raw text available, as well.

So that's Link Maker in a nutshell. It's simple. It's all UI oriented. It's a bit of HTML that you can drop in. It's a great way if you haven't started and you only want - interested in linking to a few pieces of content, to find that. But maybe you've already got a website up and running, and you've got a couple hundred links to various pieces of iTunes content.

In that case, you might be interested in Auto Link Maker. Auto Link Maker is a way to on the fly, attach affiliate data to existing iTunes links within a webpage. It's a small bit of JavaScripts that you paste into your page, and on load, it actually finds all of the links to the iTunes Store, and when they're clicked, the Event Handler attaches affiliate data to the URL, and you get credit for the links that you're already sending to the page.

So if you don't want to go in and edit hundreds or thousands of pages in your content website to, you know, annotate all these links with affiliate data, Auto Link Maker can really help you out there. So that's the simple stuff that you can do. You might be more interested in the advanced stuff for finding content, and for that, one of the best tools are the Search and Lookup APIs. And this provides metadata access on the web, up to date, and very, very easy to do so.

There are two main actions. The first is Search. This is probably like you expect. You can find content by name. If you know the artist name or the song name, or your user wants to type something in and find specific pieces of content, you can do that with the Search API. The Lookup API allows you to cross-reference your IDs with the iTunes Store. So you might have a set of content that you're interested in, and you know the iTunes Store content IDs, you can get the latest data about that content using the Lookup API.

And all these responses are in the JSON format. That's JavaScript object notation. It's pretty much the lingua franca for data transfer on the web. So let's take a look at the search API. The only thing that's required to get started with the search API is the term Query Parameter, and this of course, is the search term that you're interested in.

But there's a lot of modifiers available, and you could do some really interesting stuff to find specific pieces of content. You can also change the nature of the content that comes back. So the Language Query Parameter allows you to specify the localization of the response. So let's say you're searching in Canada for a piece of content, but you know you want to localize it to French. You can pass in Language equals FR and get a result back in French.

Media is a constraint for the search itself. If you only are interested in movies or only interested in books, you can specify Media equals Movies or Media equals Books and get content back that way. But what if you're actually just interested not just in say, music, but you're interested in songs, or you're interested specifically in albums. You can use the Entity Query Parameter to specify a very specific piece of content or collection of content that way.

Attribute is another query parameter that focuses the search term on a specific case. So the search will only be applied to a specific portion of the content, and this would allow you to, for example, if your query is for Madonna, you might be looking for the musician Madonna, and you could use Attribute equals Artist's name and the searches would only be for artists whose name contains Madonna. On the other hand, maybe you're looking for the Beatles' popular song "Lady Madonna." You can specify Attribute equals Song term and get song results back.

The Limit Query Parameter is another one where it can come in handy in many situations. By default, you're going to get 50 results back for a given query, but if you only want five, there's no reason to spend time parsing the results and waiting for the response for a larger data set. So you can either decrease or increase the size of the response set you get.

And finally, there's Callback. Callback is very useful for web developers if you are trying to do something that operates within the Java excuse me, the browser security model. So if you're running JavaScript in a browser, you may not have access to make a call to iTunes.apple.com. But you can use the Callback Query parameter to essentially call a function with the result of the query. This can be very useful, and just about every JavaScript library like J Query, what have you, supports Callback.

And all these responses, once when you do a query, all the results are in the JSON format, and they're dictionaries of content sorted by relevancy. And relevancy is an important concept. It's not - it's our best guess at what you're actually searching for. So it depends on how appropriate is the content to the search term. And it also depends on other factors like popularity.

So that can be - so your search queries are not necessarily static. They're not going to be set in time. If another piece of content becomes more popular, it might move from rank number three to rank number one, and your search results will change even though the query parameter is the same.

Now the Lookup API uses a lot of similar query parameters to the Search API, but the only thing required is an ID, and the ID can be an iTunes Store content ID, or it can be a list, comma separated, of those same IDs. The Lookup API also supports other identifier standards. So if you have UPCs for albums, or ISBNs for books, or ISRCs, or any number of other standard ID schemes, you can pass those in as well.

So we support similar modifiers to the search API. Language is a - as you would expect, Callback is as you would expect. The results are the exact same content dictionaries, and you can pass them into some function you define in JavaScript. Entity is slightly different in the Lookup API.

So you're passing in one or more content IDs, and you can use the Entity ID to actually navigate up or down the content tree. We'll go into how you can use this in a bit. And again, the results are JSON dictionaries, so it's the exact same content whether you're using Search API or Lookup API.

And the responses you get back are very, very rich in data. Now I know this is a wall of text, but there's a lot of information here that you can use to populate your UIs or to populate your recommendations. There's the expected. You can get the artist ID, the artist name, the album name, the song name, app name, what have you.

But there's also you can get the - what's the most recent version on the store? What are the release notes for that version? When was it released? How much is it? What's the file size? Maybe you only want to recommend small files to your users on some sort of constrained device. You can see screenshots, album artwork. What is the user rating for this particular content? What is the age rating for the content? All this can really be useful if you're trying to populate a UI.

So that said, let's go through a couple examples. Let's say we are developing a music app and we want to show the user a search API so that they can find content on the store. So we might have a search box that they can type something in, and we would put that content into this sort of URL. And I want to highlight that we're specifying the U.S. Storefront, and we're passing in the term that we're trying to search for in the query parameter term. In this case, the user has typed in "The A Team." Excuse me.

Now this query alone is going to be - what you're going to get is basically one of Ed Sheeran's popular songs from the past couple years, which is called "The A Team," and that's going to be very popular, so that's going to be at the top of the list.

Following that, you're going to see something like the "The A-Team's" movie, which came out a couple years ago, and is second behind the song content. And following that, you're going to get about 45 results for the "The A-Team" TV show from the '80's. Now, "The A-Team" show is awesome. Who doesn't like the "The A-Team." That's great. But we're a music app so we might not be interested in getting TV show results.

Now the simple thing to do in this case would just be attach a limit. We can say, "Oh, well I'm only interested in the music stuff. The music stuff is ranking highly, so I'll put Limit equals 1 and I only get one result back." That's great, but what if another sequel to the "The A-Team's" movie comes out and suddenly that's highest. Our music app is suddenly showing content for movies, and that wouldn't be good.

So that's one option. There's a couple other things we could do. We could say well, we're only interested in searching for the song term "The A Team," or we're only interested in songs that are related to the search term "The A Team." But that's not really - that's going to limit us a little bit, because what if we want to show albums, or what if we want to search on albums that are called "The A Team." There's probably several of those.

So for our use case, this is probably not such a great idea. Instead, we need to find the right thing to specify the type of content we're interested in, and here, it's media=music. We're a music app. We want people to be able to search for artists or albums or songs, whatever. So we can specify media=music and we get just the results we're looking for. So we run this query and we get the results we want back, which is great.

Now, this is just one piece of results, or one result back. Let's say our UI, we might have an album focus, rather than on a specific song. And let's say that our UI we want to know how much does the content cost in the storefront. And furthermore, we want to show them all the songs on that album in that storefront.

Now, I like to say that if you have a problem, if no one else can help, and if your problem relates to content metadata on the iTunes Store, maybe you can hire the Lookup API. In this case, we have figured out that our user is in Great Britain, and so we would just change the country code in the URL to be GB, Great Britain, and we're passing in the ID of the collection itself. Now the Lookup API has a very simple model for content on the store. There are tracks, which are individual, indivisible pieces of content. So this would be songs, books, movies, TV episodes, apps.

There are collections, which are albums, TV seasons, that sort of thing. And there are artists. These are musicians, actors, app developers, that sort of thing. Three levels, and you can use the Lookup API to navigate that hierarchy. So we're passing in the collection ID or the album ID to the Lookup API, and we're going to get results back to see if it's available for sale in Great Britain.

What we're not going to see is what tracks are available on that URL. What we need to do in that case is attach the entity that we're looking for, and the entity=song will tell the Lookup API, okay, give me back the results that I asked for, but also give me back the songs that are on that album. And here, we get the awesome results back that you expect.

So we get the album name, which is "Plus," and the first track on that album is the "The A Team" and so on the rest of the songs on that album. You can also go - navigate up the content hierarchy, so if you've got a song and you want to know the artist, you can pass in entity=artist and track that that way. So there's a lot you can do with the Lookup API. It's all up to date. You might want to know about price changes for particular things. The Lookup API allows you to do that.

Now, that said, you might have slightly bigger needs in terms of data. And for that, we have the Enterprise Partner Feeds, or EPF as we commonly call them. These are bulk metadata, and it covers virtually all iTunes Store content, and this is very much for - intended for big data needs.

And when I say big data, it's a lot. It's something like if you download the full data set for this week, it's going to be 10 gigabytes of textual data compressed. So it's not for the faint of heart, but it can be very useful if you're trying to establish an understanding of the entire iTunes universe.

Within the feeds are multiple files, and the files represent database tables in a relational database sense. So there is for example, an artist table representing artists- you know musicians, app developers and the like. There's an application table for iPhone apps and Mac apps, that sort of thing. And as you might expect if you are familiar with relational databases, there's a relational artist application table that represents which artists produced which apps. So you can ingest this data into a relational database or other data store for analysis and run your queries that way.

And again, it's aimed at organizations that have really deep data needs. There's a lot of data. There's pricing for all countries that the iTunes Store supports, and analyzing that and dealing with the data, especially on an ongoing basis, can be really a huge effort. Fortunately, we do have an Importer script.

The script is available as a Python app, and it's intended to ingest a feed into a MySQL database, but it's - the sample code is open, so if you'd like, you can provide a different back end and maybe write to Hadoop HDFS or something like that if your needs go that way. So the Enterprise Partner feeds - it's a great way to get the whole content database for iTunes. You can do a lot with it, but it takes some doing.

Slightly simpler is the RSS feeds. These are dynamic feeds for kind of what's hot in a store. And by that I mean, you've got a couple options. You can see what's most popular for each piece of content and in each genre. What's selling really well right now? What's new? What's recently added? Whether this is, you know, the hot new single from today's artists or maybe a piece of an album that has been out of the store for decades and is just arriving now.

That's shows up in the New and Recently added feeds. You can see featured content - what's actually showing up on the store right now, what's a user see when they open iTunes to the main page and check that out. And finally, you can see customer reviews for a particular piece of content. What are people saying about it? There's - if you want to track your own apps' performance, you can see recent customer reviews using that RSS feed.

RSS is available in Atom format. That's pretty much the standard for RSS these days. It's also available in JSON. If you don't want to parse a bunch of XML, you can get a JSON format returned to you and ingest it that way. So that's the advanced stuff. There's all this and more is very well documented on the website, and we'll have a URL for you at the end of the session.

Smart App Banners are a way for you to cross-reference your app from a website, and you've probably seen this browsing the web with the mobile Safari. You link to a website, and this little banner slides down and allows you to download the app if you haven't already, or open it if you've got it installed, or dismiss it if you're actually not interested in the app. So from the user's perspective, it's really powerful. It's - if you want it, it's there, and if you don't, it gets out of the way.

What it does allow you, the developer, to do, is to show your content from your website in a native, custom experience that your app can provide that mobile Safari maybe can't. So this is really powerful if you want to show or - have people look at the content on your website in your custom app.

And again, if a user is not interested, a simple tap and it goes away, and they're not bothered by it. So how do we integrate with that? It's actually fairly simple. You drop a simple metatag into the head of your web page, and the metatag has your app ID defined in it. That's pretty obvious. We've got to know how to find it.

And when Mobile Safari sees that, it's going to fetch the content, get the latest price and show it to the user. You can also pass in your affiliate data. So here we've got our affiliate token, which defines us to the affiliate program, and we're setting the campaign token as Smart Banner so that we can see how many people are actually clicking on the Smart Banner from our website.

Now the app argument is actually a really important piece of data here. If we are running a news website or a music recommendation website, and we're asking the user to leave Mobile Safari, leave all that context and launch into this custom app, we don't want to lose - we don't want them to, you know, start at the home page of our site again.

The app argument is actually provided to the app on a command line and you can see the same content that the user was looking at on the store. So it's a way, you know, it's easy, easy integration without really interrupting the flow of things. So that's Smart App Banner. If you've got a large website, it's a very useful tool for cross-referencing your website and your app.

The StoreKit Product Sheet is a brand new feature that we've got and for the affiliate program. It actually exists since iTunes 6 and allows you to show iTunes Store content without actually leaving your - the workflow that your user was in. So for an example, we've got here on Twitter, the user sees a link to the iTunes Store and taps on this icon, and the store sheet slides up and allows the user to do all the expected things that you would do in the store. So you can read reviews. You can look at screenshots.

You can buy it right then and there. Most importantly, when they're done, they can dismiss the store - or the Store Sheet, and they're right back in the app on the page that they were in before, so there's no double tap to the home screen and going back to your app. It's all right in the same flow.

Now the Store Sheet, as I said, has existed in iTunes 6, but only recently have we added it to the commission structure. So that means if you add affiliate data to the Store Sheet, you're going to get paid that same 7 percent over 24 hours that you did before. And to go over a demo of how we can use the StoreKit Product Sheet in our apps, I'm inviting my friend Rick Rubenstein up to show us how to use Xcode and drop it in.

Thank you Mark. So I'm Rick Rubenstein. I write tools and automation for the iTunes store and App Store and other related products. And Mark asked me to put together a quick app to show how the StoreKit product works, out in the lobby before the session. Kidding, I wrote it a little while before that. So let me switch over to iOS here.

So I'm going to fire up the app that I wrote right now, and then I'll explain how it was built afterwards. So here we have your typical stick figure doing a juggling trick app. I'm sure you all have several of these loaded on your own iOS devices. And if I'm a user, and I'm mesmerized by this juggler, I might say to myself, you know, I would like some sort of a juggling-related game.

Oh look, there's a button right here in this very app that will let me get that content from, in this case, the App Store. So if I tap on that link, it will bring up the StoreKit Product Sheet, just as Mark showed, and in the case, the StoreKit Product Sheet is displaying a juggling-themed ball app.

Now the key thing here is that while it may look as if I'm in the App Store right now, the Juggling dude app is still running there in the background. So if I had wanted to when I brought that up, I could've actually decided to buy this app. I'm not going to do that right now because I'm cheap, but if I were an actual customer, I might do that. And then you, the affiliate, would receive credit for that purchase.

I'm going to bring this up one more time. Now if I had decided to click on - to tap on the store link in the upper right, then the user would be taken to the App Store. That same content would be displayed, and anything that that user bought within the 24-hour bounty window, you, the affiliate, would receive a commission on all those purchases.

So I'm going to switch over now and show you what actually happened there. So here we have the new affiliate dashboard that Mark showed before, and this is live in Safari, and you can see that there are the clicks that I made during the demo. They've already showed up, the taps that I made. This bump here earlier is when I was rehearsing beforehand. And so this shows the near real-time tracking of all of the affiliate data.

So I'm going to put this away and bring up Xcode and show you exactly how you can go about putting the StoreKit Product Sheet in your own apps. It's very simple. So the first thing you need to make sure you do is link against the StoreKit framework. This is a public framework that is available to any iOS developer, and it lets you interact with the iTunes Store, the App Store in various ways.

In this case, the way is by the StoreKit Product Sheet. So here we have the header for our main ViewController, and again, just showing here that we are importing the StoreKit framework that lets us access the StoreKit Product Sheet. Sorry, this is all objective so you haven't had a chance to write it in Swift just yet.

So here we have the implementation for the ViewController, and this is the key method right here. This is the method that I have defined on the ViewController class, which I've called simply Store Sheet for Product - takes three parameters, the itunesId, the affiliateToken and the campaignToken. Now this is the new difference in iOS 8. As Mark mentioned, the StoreKit Product Sheet itself has been available since iOS 6, but previously, you could not include the affiliate data. Only one parameter was accepted, which was the itunesId.

So now you can add the affiliateToken. That's your usual affiliate token that identifies you. And the campaignToken, which as Mark mentioned, can be any string up to 40 characters in length that you can use to identify your different campaigns, group your data however you want to analyze it.

So I take these three parameters, and I put them into a standard NSDictionary. Move this so you can see this better. Simple dictionary. These are symbolic constants that are defined in the StoreKit framework. The SKStoreProductParameter ITunesItemIdentifier is the itunesId. That's this one that you passed in and the two new ones, the ProductParameterAffiliateToken and the ProductParameterCampaignToken. Those are optional. You don't need to include them, but since you are an affiliate, you probably do want to include them so that you earn your commissions.

So the next thing you need to do is actually create to the ViewController. You do that using a standard Objective-C, alloc init model, which you're probably familiar with, and you need to set a delegate for it, which will be called back when it's time to dismiss the sheet. And in this case, we're simply setting the delegate to ourselves, the same ViewController object that we're using. So here's the key call right here. We need to load the product into the controller.

So this is the method on the StoreKit View Product Controller. Load product with parameters. Parameters is the dictionary we just created that contains again, the iTunes ID, the affiliate token and the campaign token. It also takes a completion block, which is the standard Objective-C block, which will return a result, simply yes or no as to whether it successfully loaded. And in the case that it didn't successfully load for some reason, say that you somehow had an incorrect piece of content that didn't actually exist on the store, there's an error parameter.

And in the block, we define what we do in these two cases. In this case, if there's an error, we're just logging it normally. In an actual app, you would probably want to display some sort of dialogue or UI to the user saying that this content for whatever reason failed to load in the sheet. And if it successfully loaded, here we're simply logging that it loaded. Normally you wouldn't need to do anything in that case, just go on.

So at this point, you have loaded the product into the sheet but you haven't actually displayed it. So that's what this call is here. So we call on ourself, which is our ViewController, present the sheetController. Animated, you normally want a yes, and that also takes a completion block. And in this case again, we aren't doing anything in particular in the completion block. Just for reference, we're logging that we've completed.

One more important method here is productView ControllerDidFinish. This is the callback method that gets called whenever the sheet action is complete either by the user clicking cancel, clicking outside of the sheet or going elsewhere from the sheet. And this is where you actually dismiss the sheet to get it to go away. Otherwise, it will remain up. The cancel action won't appear to have done anything.

And this is simply the IBAction, the Interface Builder action that we tied to the button that was in the top of the app and simply in this case, preloads it with the iTunesId of that juggling pinball app that I showed, and the affiliateToken and the campaignToken. The code for getting the guy to do the juggling trick is left as an exercise for the viewer. So that's the StoreKit Product Sheet. It's very simple to implement. It's just a couple of calls and it's pretty powerful in conjunction with the affiliate program. Thank you.

[ Applause ]

  • Back to you, Mark.
  • All right. Thanks very much, Rick. That was awesome. So like he said, StoreKit Product Sheet, you can do a lot with it, and best of all, for your users, it's very unintrusive, so take a look. Next up on our list of things to talk about is iTunes Radio. Now iTunes Radio launched recently, and even more recently, we have added it to the affiliate program, which means that if you link to an iTunes Radio station, you get credited for that referral.

And again, it's very easy to do. Here's another example using our friend Ed Sheeran, and we're in the Sound Hound app, and they've got a link down near the bottom of - that links to iTunes Radio. And when the user taps on that, the radio station is going to be created and added to their stations, and the song that the radio station starts with begins to play.

So this is a great way to tell your users or to recommend a certain set of content to your users. Maybe they don't want to buy it, but they want to listen to music that's inspired by a particular artist or song. You can get them into the iTunes Radio experience and listening to music immediately.

Best of all, this is supported with the affiliate program with the same terms as everything else. So 7 percent over 24 hours, and that applies not just to purchases made within the iTunes Radio app, but any other store on that same device where the cookie exists. So that means music, of course, apps, books, movies, all the rest, are all supported under the affiliate program.

Now to construct a link to iTunes Radio, we've added some functionality to the Search and Lookup APIs so that the content result that you see will have links to the radio stations themselves. So here, we're looking for Ed Sheeran, and in the result set that we get back, we're looking for an artist.

The JSON has a radio station URL, and you can use that special URL to launch into the iTunes Radio application. You would of course have to add your affiliate data to this URL as we've been discussing. So that's iTunes Radio. It's a great set of music for users to listen to, and you get a bonus for any purchases made after clicking that link.

We're going to end up talking today about collections, and collections are something you might be familiar with from previous talks. It used to be called Web iMix, but this is a dynamic playlist that is defined entirely by a URL, and here's what it looks like. This is a collection we've defined by creating a special URL, and we've set the title.

We've set the description. Now there's a limit on what kind of text you can put in the description, but it's fairly broad. And finally, we can actually define the content of the playlist itself. So here we've got four songs by Ed Sheeran, and the user can buy each of these individually or tap a single click and buy the whole thing at once.

So how do we do this? The - to create a Collection Link you need set something up beforehand. What you need in addition to the normal affiliate signup is to get a special collection account with us. We will tell you a special web developer ID and a shared secret, and the shared secret is used to cryptographically sign these URLs, so we know who the author is of that title, and description and the content.

Collections support songs, albums, movies, TV shows and music videos, so you can have kind of a wide-ranging set of content that you link to, and this could actually be pretty high value. If you know your user is interested in six different movies, and they're ready to buy, they're ready to go, you can put a single link in front of them and they can buy six movies with one tap. That can mean a lot of money in terms of commissions.

To get started with the Collection system, you - there's a bunch of documentation available online, but let's take a look at what these links actually look like. They're rather intimidating at first, but we can break them down for you. We start with the Prefix, which - has a little bit of history, viewWebIMix.

There's the title that we defined, of course URL encoded. The description is also in there, and the IDs that we wanted, URL-encoded again so that the link actually works, are in there. Additionally, we've passed in a wdID. That's the Web Developer ID. And we've signed - we've done a little bit of cryptography and we've added a key to the URL, and we put that into the key parameter.

And finally, we've got our affiliates hooking up at the top because we want to get a commission on this link of course. So this is a great way to make things happen on the fly if your user has a special set of desires that you know about. You can put together a single collection with this on the fly. You don't need to do - you don't need to register a particular collection beforehand. Once you're signed up, you can do this any time you want.

Now on the other hand, maybe you don't want to have the difficulty of defining these URLs programmatically. For that, we have Collection Builder, and this is a really simple UI to define the title and description and the content. And the Collection Builder, if you pass in a wdID and your shared secret, will create the URL for you. So if you've got maybe a game and you want to promote the soundtrack to the game, and maybe you've got a comic iBook that kind of expands the game's universe - something like that - you can define that very easily via Collection Builder.

Once you've got your title and description, you can start searching for additional content, add that to your dynamic playlist, and you hit go, and you get a collection URL that you can paste into your web page or into your app, whatever you need. So that's Collection Builder. There's a lot of interesting things you can do with that with the right situation.

So to summarize, most important thing to take away with you right today is that we've got one program that works worldwide. Sign up is trivially easy, and once you do that, you're going to be able to market your content in 147 countries, and that list is growing as well.

We've got a simplified link structure, so you don't have to figure out what one URL looks like to one user and then present a different URL to another user in a different region. That is a huge headache removed. We've got a unified dashboard, so we can see what's going on at a glance across the world, or we can drill down into a particular country, a particular content type.

Really powerful, real time, really great. We've got a great new commission structure: 7 percent over 24 hours. That can mean a lot to your bottom line. We've added iTunes Radio and the StoreKit Product Sheet to the affiliate program so you get credit - the same structure as everything else by using that.

And of course, we've got a lot of tools and a lot of documentation available online. So check it out. The documentation - we have a whole resource site at affiliate.iTunes.apple.com. Highly recommend checking that out. There's a support link available too, and of course, there's devforums if you any questions that you want to ask your fellow developers.

There's a related session happening tomorrow about using StoreKit. It's called "Optimizing In-App Purchases," and they'll be covering a bit about the StoreKit Product Sheet there. And if you have any questions about the affiliate program or the StoreKit Product Sheet, we've got a couple labs in the next couple days. We're going to be downstairs at 2 p.m. so feel free to come by, say hello, ask some questions. We'll be glad to help. That's it for the presentation today. Thanks all for coming and have a great rest of the conference.

[ Applause ]