Before you begin

This page shows the setup steps that are required before your app can access Discovery for Media.

Create a project

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project.

  4. Install the Google Cloud CLI.
  5. To initialize the gcloud CLI, run the following command:

    gcloud init
  6. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  7. Make sure that billing is enabled for your Google Cloud project.

  8. Install the Google Cloud CLI.
  9. To initialize the gcloud CLI, run the following command:

    gcloud init

Turn on Discovery Engine

To use Discovery for Media, you must turn on Discovery Engine and accept the Discovery Solutions data use terms.

To turn on Discovery Engine, follow these steps:

  1. In the Google Cloud console, go to the Set up Discovery Engine API page.

    Go to the Set up Discovery Engine API page

  2. On the Turn on Discovery Engine API page, click Turn on API.

  3. When Discovery Engine API displays as Enabled, click Continue.

  4. Read the Discovery Solutions data use terms and click Accept if you agree to the data use terms.

    When you accept the data use terms, the Google Cloud console indicates that the data use terms are accepted.

  5. Click Continue.

  6. On the Create Data Store page, click Create.

  7. When the page displays Data store created, click Get Started.

Set up authentication

You must set up authentication so that clients, such as a video streaming app, can access Discovery for Media. Here are the ways you can authenticate to Discovery Engine:

  • In a local environment. If you plan to use client libraries, run code samples, or use third-party tools in a local development environment, you must set up Application Default Credentials (ADC) in that environment. For REST requests from the command line, you use your gcloud credentials. For more information, see For a local development environment.

  • On Google Cloud. To authenticate a workload running on Google Cloud, you use the credentials of the service account that is attached to the compute resource where your code is running.

    For more information, see On Google Cloud.

  • With an API Key. Clients use an API key for calls to the userEvents.Collect method. You need to set up this authentication method only if you intend to capture user events from users' browsers through a JavaScript pixel. For more information, see Create an API key.

Create an API key

An API key is required if you use a JavaScript pixel to capture user events from users' browsers. For more information about ways to capture user events, see Record real-time user events.

To create an API key for calls to the userEvents.Collect method, complete the following steps:

  1. In the Google Cloud console, go to the Credentials page.

    Go to the Credentials page

  2. In the project drop-down at the top of the Google Cloud console page, select your project (the project might already be selected).

  3. Click Create credentials and then select API key. Do not add any referrer restrictions. Some user privacy settings are known to not pass the referrer URL.

    • Take note of the generated API key, which you will use when calling user event logging.
  4. For increased security, add an HTTP restriction to your API Key to restrict access to the Discovery Engine service at https://discoveryengine.googleapis.com/*.

Before you create a model

Before you can create a recommendation model, you need to import the data that the model will train on. You also need to get user event data and create a serving config for the model. Complete the following tasks to get started with Discovery for Media:

  1. Import your documents. You can import your documents from Cloud Storage or from BigQuery. For more information, see Import documents.

  2. Import historical user events. User events are combined with information about the documents to train the model to recommend documents that are relevant to your customers. For more information, see Import historical user events.

  3. Create a serving config. Create a serving config to configure your recommendation results. For more information, see Create serving configs.

What's next