[MUSIC PLAYING]
TODD KERPELMAN: OK, let's talk audiences.
Audiences are groups of users you
define in Firebase Analytics that can be used
in a number of different ways.
You can filter analytics reports and dashboards
against a particular audience.
You can send Firebase Notifications
to a specific audience.
You can send different remote config data
to different audiences.
And you can target these audiences
in remarketing campaigns like AdWords.
Now they can be very broad, like people have made
and in-app purchase, or very narrow,
like Canadian women over 35 who are fans of yoga
and have shared my app with their friends.
And while they are quite powerful,
they also have a number of limitations.
And the key to most effectively using audiences
is to understand these limitations.
So let's go over these.
First, audiences are not retroactive.
When you create an audience, it will initially be empty.
See, it turns out that the logic that's
used to determine if a user is part of an audience
is located on the client.
So when you create an audience, you'll
need to wait for the clients to receive that audience
definition and then decide for themselves whether or not
that user belongs to a particular audience.
Additionally, if your audience depends
on an event being triggered, like making a purchase,
you'll have to have that event happen again on the client
before the client decides to place
that user into an audience.
Second, audiences that include your user's gender, age
or interests, the data you get when you hook up
the Add Support Library, can only
be used for building AdWords campaigns.
You can't use them for remote config or notification groups.
Finally, the way audiences currently work,
once a user joins an audience, they don't ever leave.
They're like the "Hotel California" of user groups.
Now to some folks, like people who
deal with remarketing campaigns, this generally
works the way they expect.
But for those of you new to audiences,
this can cause some confusion.
For instance, let's say you tried
to create a just browsing audience of people
who visit your in-app store, but don't make a purchase.
Now initially, that audience would start off
pretty true to its name.
People might visit your in-app store, not make a purchase
and be placed in your audience.
But over time, people in that audience will make purchases,
but they'll still remain if you're just browsing audience,
which means that this audience isn't really all that accurate
anymore.
It's this mix of browsers and purchasers.
So my recommendation is when you first
integrate Firebase Analytics, one, remember this "Hotel
California" rule.
It'll make it easier to understand
what audience definitions will be useful in the long run.
And two, early on in the process,
add a handful of audiences that you're
pretty sure you're going to want to use.
This will ensure that they start populating as soon as people
start using your app.
So with that in mind, let's add an audience to our app.
Now I'm going to go back to this fascinating sample app
that I've used so far in my previous two videos.
So if you want to follow along and have
been using your own version of the sample app
in the last couple of videos, keep using it.
Otherwise, any app should work as long as you've already
installed Firebase Analytics, and have set up a few events
and a user property or two.
So our marketing team is very interested in cat people
who use this slider here.
They think they'd be the perfect audience
to upsell our new laser pointer feature to.
So they're going to want to create
an audience of these people, which we'll
do by combining the Adjust Slider
event with the dog or cat person user property.
Let's give it a try.
[MUSIC PLAYING]
So the first thing I'm going to want to do
is create an audience.
I'll head on over to the Firebase
console and select Analytics and select my app.
I'll select Audiences here.
And you'll notice that Firebase already
has two audiences set up for me-- All Users and Purchasers.
Now to create my new audience, I'll select New Audience,
will call my audience Cat Sliders,
and I'll add a short description here
to remind myself what this audience really is about.
So the first thing that we're going to do
is select User Property from this dropdown.
Notice that the comparison operator here says Equal To.
But if you look at the full dropdown,
you can see this is actually for numbers,
and I'm storing this as a text string.
So I need to select this Exactly Matches condition instead.
And then here, I can select Cat Person from the dropdown.
Now if you don't see these values in the dropdown,
your app might not have submitted enough user
properties yet for them to appear,
but you can still type them in by hand.
Next, I'll click And to add another condition
of my audience.
Since I want an audience of cat people
who have adjusted the slider, I'll
also go ahead and select Event, and then select Adjust Slider.
By default, it gives me this count greater
than zero condition, which is what I want.
Notice this Add Parameter feature.
This allows me to refine this audience
based on some of the custom parameters passed
in with this event.
If I wanted to make this audience consist of people
who only adjust the slider to the right side, for instance,
I could do that here.
But in my case, this isn't really necessary.
And that's about it.
I'll create my audience, and I'm done.
Now you can see that this audience is initially empty
because of that whole audiences are not retroactive thing
I was talking about earlier.
But let's go into my app and test it.
So before I start up my app, I'll
double check that I already have Analytics Debugging turned on,
which I did a couple of videos ago.
And now, I'm going to go ahead and make
sure I'm part of this audience.
I'll specify that yes, I am a cat person.
And then I'll go ahead and use the slider.
Now I'll hit Command Shift-H to go into the background.
And if you dig into the output here,
you can see I have this audience evaluation results section.
Here, it looks like it's added me
to the audience with the ID of 2,
which I'm pretty sure is the audience I just created.
And now if I go back to the Firebase console,
you can see that my audience which formerly
had fewer than 10 users now has fewer than 10 users,
or I guess more accurately, in fewer than 10 devices.
But trust me, when this app gets more users,
it'll be a lot more exciting.
So once this audience gets beyond 10 users,
I can start using it to filter my reports and notifications,
or target via my AdWords campaigns.
And then he can finally start selling these cat people
my laser pointer upgrade.
[MUSIC PLAYING]
So hopefully this is enough to get you started with audiences.
Like I said at the beginning of this video,
I think audiences work best if you have a bunch of them
already defined when you incorporate analytics
into your app.
So start thinking about what audiences make
the most sense for your app.
In the meantime, feel free to check out our documentation,
subscribe to the Firebase channel.
And I will see you soon on the next episode of "Firecasts."
[MUSIC PLAYING]