Git Product home page Git Product logo

dv360_feature_adoption's Introduction

Display & Video 360 Feature Adoption

This is not an officially supported Google product. It is a reference implementation.

Overview

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.

Prerequisites

Deployment

  1. Clone this repository:

    git clone https://github.com/google/dv360_feature_adoption.git
    
  2. Change into the repository's directory:

    cd dv360_feature_adoption
    
  3. Install the dependencies:

    yarn
    
  4. Create a Google Cloud project (skip if using an existing project):

    gcloud projects create dv360-feature-adoption
    
  5. 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
    
  6. 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.

  7. 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.

  8. 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.

  9. 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
    

Scheduling

  1. 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.

Testing

  1. Run the function locally:

    yarn run-report
    yarn run-sdf
    
  2. 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] }'
    

Authors

dv360_feature_adoption's People

Contributors

pgilmon avatar tonycoco avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

isabella232

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.