• Recipes
  • Marketing
  • Drive new revenue by building a custom first-party ad server

Drive new revenue by building a custom first-party ad server

Marketing Engineering Founder Executive Product Mobile B2B Retail Marketplace Media Startup Beginner

Made by Kevel

In this recipe, you’ll learn how to turn Segment Personas into Kevel audiences whom you can target with personalized ads and content within your own website or app, enabling you to generate new revenue via tailored ads and optimized internal promotions.
What do you need?
  • Kevel's UserDB
  • Segment Personas
Drive new revenue with Segment
Collect data once with Segment and send it any tool you use. No more tedious integrations. No more engineering resources wasted.
Start with Segment

Many successful brands — Facebook, Google, Amazon, Etsy, Pinterest, to name a few — have proven that custom ad platforms can drive billions of dollars and give them the capital to beat their competitors. These ad platforms nearly always tie together native ad units with first-party data targeting.

If you’d also like to monetize and drive new revenue in this way, you’ll need a way to tie together your first-party data with your ad server. You can do that with Segment and Kevel by automatically pushing your Segment Personas directly to Kevel, which can then be targeted in a campaign.

This recipe specifically looks at how to connect Kevel with Segment, send Personas Audiences to Kevel as custom audiences, and then show them ads inside your own website or app.

Step 1: Connect Segment to Kevel

Start by connecting your Segment and Kevel accounts. You’ll need your Kevel network ID and API Key, which can be found in the Kevel UI. 

From your Segment account, search for Kevel's Destination Integration and click "Configure Kevel".

Kevel-1

Next, you'll need to connect your Segment Source with the Kevel Destination. Once you select a Source, it's time to configure your credentials. You will see an interface similar to this:

Kevel-2

To get your API Key, log in to the Kevel app and navigate to "Settings" -> "API Keys" via the top navigation. You'll see all your API Keys listed there.

You can find your Network ID using the "Information" bubble next to your username in the top right corner of the Kevel app.

Kevel-3

Step 2: Create an audience in Segment Personas

This recipe assumes you have Segment installed and are tracking events tied to a specific User ID.  From those events you can define a new audience definition in Personas. In this example, we’re creating an audience named “Influencer” based on their Twitter follower’s trait.

kevel-4

Once you’ve defined the audience rules, then connect the audience to the Kevel Destination.  If Segment asks, it should use the Identify event for this connection.

Personas will send an event to Kevel’s UserDB for each member of the audience, and Kevel will record the audience as a UserDB interest.  

Step 3: Create a custom targeting campaign in Kevel

Now, in your Kevel account create a new campaign and a flight, and in the flight use a custom targeting rule like the following example. Alternatively, you can also leverage Kevel’s Campaign APIs.

Kevel Custom Targeting

This custom targeting rule checks the UserDB record at time of ad request to see if the user has the “Influencer” interest.  If so, then we know they fall into the Personas “Influencer” audience, and the ad will be eligible to be served.  Anyone outside of that audience would not receive this ad.

Step 4: Send Decision API requests containing User IDs and serve the ads

You also need to ensure you’re sending User IDs in the ad request for all API calls. This persistent user ID should correspond to the ID you gave to Segment for that user, and be sent as the key value in the `user` object in the Decision API request.

```

{

  "placements": [

    {

      "divName": "homepage",

      "networkId": 23,

      "siteId": 667480,

      "adTypes": [5],

      "eventIds": [12,13,14]

    }

  ],

  "user" : {

    "key": "ad39231daeb043f2a9610414f08394b5"

  }

}

```

If Kevel’s system does identify a user as an Influencer, the campaign targeting these Influencers would be eligible to be shown. If that ad wins the auction, Kevel’s API response would include information about the ad, including image URL, tracking URLs, metadata, etc, and you would then insert the data directly into your backend system before the content loads for the user.

Kevel Results

Wrapping up

Here’s what we’ve done in this recipe:

  • Connected Segment and Kevel

  • Defined an audience in Personas to identify Twitter influencers and inform Kevel’s UserDB

  • Created a promotional campaign in Kevel that will target only your Twitter influencer audience

  • Sent Kevel Decision API requests containing the UserKey