This is not an officially supported Google product. It is a reference implementation.
This is a reference implementation for a solution that will pull the necessary SDF and reports needed from Display & Video 360 into BigQuery to create a feature adoption dataset.
The idea is to deploy a set of Cloud Functions and schedule jobs for individual Display & Video 360 advertisers to generate a feature adoption dataset every 24 hours for analysis.
-
Clone this repository:
git clone https://github.com/google/dv360_feature_adoption.git -
Change into the repository's directory:
cd dv360_feature_adoption -
Install the dependencies:
yarn -
Create a Google Cloud project (skip if using an existing project):
gcloud projects create dv360-feature-adoption -
Enable the Cloud Build, Cloud Functions, Display & Video 360, BigQuery, and Cloud Storage APIs:
gcloud services enable cloudbuild.googleapis.com cloudfunctions.googleapis.com doubleclickbidmanager.googleapis.com displayvideo.googleapis.com storage.googleapis.com bigquery.googleapis.com -
Create a Service Account for authenticating:
gcloud iam service-accounts create dv360-feature-adoption \ --display-name="Display & Video 360 Feature Adoption"You may need to grant this new service account the BigQuery Admin role in the Cloud console.
-
Create a Display & Video 360 User Profile using the service account's email address in the UI and give the user access to the Advertiser IDs you plan on scheduling jobs for.
-
Deploy the provided Cloud Functions to your Google Cloud project:
gcloud functions deploy DisplayVideo360FeatureAdoptionSdf \ --runtime nodejs14 \ --memory 1GB \ --timeout 540s \ --trigger-http \ --service-account "[SERVICE_ACCOUNT_EMAIL]" gcloud functions deploy DisplayVideo360FeatureAdoptionReport \ --runtime nodejs14 \ --memory 1GB \ --timeout 540s \ --trigger-http \ --service-account "[SERVICE_ACCOUNT_EMAIL]"Replace
[SERVICE_ACCOUNT_EMAIL]with the email generated while creating the Service Account. -
Add the roles needed to run the functions:
gcloud functions add-iam-policy-binding DisplayVideo360FeatureAdoptionSdf --region=us-central1 --member=allUsers --role=roles/cloudscheduler.jobRunner gcloud functions add-iam-policy-binding DisplayVideo360FeatureAdoptionSdf --region=us-central1 --member=allUsers --role=roles/cloudfunctions.invoker gcloud functions add-iam-policy-binding DisplayVideo360FeatureAdoptionSdf --region=us-central1 --member=allUsers --role=roles/bigquery.admin gcloud functions add-iam-policy-binding DisplayVideo360FeatureAdoptionReport --region=us-central1 --member=allUsers --role=roles/cloudscheduler.jobRunner gcloud functions add-iam-policy-binding DisplayVideo360FeatureAdoptionReport --region=us-central1 --member=allUsers --role=roles/cloudfunctions.invoker gcloud functions add-iam-policy-binding DisplayVideo360FeatureAdoptionReport --region=us-central1 --member=allUsers --role=roles/bigquery.admin
-
Create a Scheduler Job for both Cloud Functions with:
gcloud scheduler jobs create http dv360-feature-adoption-job-[ADVERTISER_ID] \ --schedule "0 0 * * *" \ --uri "[CLOUD_FUNCTION_URI]" \ --http-method POST \ --message-body='{ "advertiserId": [ADVERTISER_ID] }'Replace
[CLOUD_FUNCTION_URI]with the deployed URI for the Cloud Functions and replace all instances of[ADVERTISER_ID]with the Display & Video 360 Advertiser ID.
-
Run the function locally:
yarn run-report yarn run-sdf -
Call the functions:
curl -X "POST" "http://localhost:8080" \ -H 'Content-Type: application/json; charset=utf-8' \ -d $'{ "advertiserId": [ADVERTISER_ID] }' curl -X "POST" "http://localhost:8081" \ -H 'Content-Type: application/json; charset=utf-8' \ -d $'{ "advertiserId": [ADVERTISER_ID] }'
- Tony Coconate (coconate@google.com) – Google