GithubHelp home page GithubHelp logo

isabella232 / argon Goto Github PK

View Code? Open in Web Editor NEW

This project forked from google-marketing-solutions/argon

0.0 0.0 0.0 73 KB

Campaign Manager & DV360 Reports to BigQuery connector

License: Apache License 2.0

JavaScript 100.00%

argon's Introduction

Argon

Please note: this is not an officially supported Google product.

This middleware automates the import of both Campaign Manager 360 (CM360) and Display & Video 360 (DV360) Offline Reporting files into BigQuery. It can be deployed onto Cloud Functions. You can trigger jobs by issuing POST calls with configured JSON, which allows for use with Cloud Scheduler. Argon uploads all values as string type, and verifies the schema with the report files' columns, at runtime. It also appends a File ID column to track file ingestions.

Setup

Google Cloud Project

  • Setup a Google Cloud project.
  • Create a BigQuery dataset - tables will be created automatically per report.
  • Create a new IAM Service Account for Argon, with the BigQuery Admin role.
  • Enable the necessary APIs in API Explorer, or via gcloud services enable :
    • DV: DoubleClick Bid Manager API (doubleclickbidmanager.googleapis.com)
    • CM: DCM/DFA Reporting And Trafficking API (dfareporting.googleapis.com)
  • Clone this repository and deploy Argon code to your cloud project:
    gcloud functions deploy argon \
        --runtime nodejs10 \
        --memory 512MB \
        --timeout 540s \
        --trigger-http \
        --service-account "[SERVICE_ACCOUNT_EMAIL]"
    

Google Marketing Platform

Accounts

  • Ensure that the CM Account has the following Permissions:
    • Properties > Enable account for API access
    • Reporting > View all generated reports
  • Create a CM/ DV User Profile with the service account's email address with the respective role:
    • DV: Reporting only
    • CM: Advanced Agency Admin, with permissions:
      • View all generated files
      • View all saved reports

Report

Note: Argon does not support pre-existing reports, as they can cause hard-to-debug issues. Kindly create a new report as detailed below, and do not change the Dimension/Metrics/Events selections once Argon has started ingesting files. Always create a new Report, if you want to change the report template. All columns are string type, and Argon will append an additional column (file_id), to keep track of ingested files. If you change the schema in Bigquery, Argon's schema check will fail.

  • Choose the necessary report template in "Offline Reporting".
  • Choose the "CSV" File type.
  • Select the required Dimensions, Metrics, and Rich Media Events.
  • Add the service account's email address to the "Share with > +add people", and use the "Link" option.
  • If you want historical data to be backfilled for the first time, select the appropriate backfill Date Range with "Custom".
  • If this range is significant, break it up into much smaller chunks, otherwise ingestion timeouts will result in partial uploads.
  • Save and run the report, for each chunk, if necessary.
  • Now, edit the report again, and select a Date Range of "Yesterday".
  • Activate the Schedule for repeats "Daily" every "1 day" and choose a far-off in the future "Expiry" date.
  • Save (and do not run) the report.

Google Cloud Scheduler

  • Create a Scheduler Job with:
    • Frequency: 0 */12 * * * (repeating every 12 hours)
    • Target: HTTP
    • URL: Cloud Function URL
    • HTTP Method: POST
    • Body:
      {
          "product": "[PRODUCT]",            // required: CM or DV
          "reportId": [REPORT_ID],
          "profileId": [PROFILE_ID],         // only for CM
          "datasetName": "[DATASET_NAME]",
          "projectId": "[BIGQUERY_PROJECT]", // default: current cloud project
          "single": [SINGLE_FILE_MODE],      // default: false
          "ignore": [IGNORE_FILE_IDS]        // default: []
      }
    • Notes:
      • Use projectId if the output BigQuery dataset lives outside the currently deployed cloud project.
      • Set single to true, to process only one file per run. This is useful if your reports are multiple GBs large, as Cloud Functions will timeout in 540s.
      • Set ignore to a list of Report File IDs, to skip wrongly generated or unnecessary report files.
  • Save the job and run once to ingest the initially generated backfill historical data file.
  • If it fails, check the logs for error messages and ensure all the above steps have been appropriately followed, with the correct permissions.
  • Moving forward, Cloud Scheduler will trigger Argon for regular ingestion.
  • Cloud Scheduler with OIDC Token

    • Add the following roles in IAM to the service account that will run the Cloud Scheduler and call Argon:
      • Cloud Functions Invoker
      • Cloud Scheduler Job Runner
    • While setting up the Cloud Scheduler job click on SHOW MORE.
    • Select Add OIDC token under Auth header.
    • Set service account email address.
    • Paste the Argon Cloud Function URL under Audience.

Development

export GOOGLE_APPLICATION_CREDENTIALS="[PATH_TO_KEYFILE]"
npm install
npm run dev     # run local server
npm run format  # format local files

argon's People

Contributors

achembarpu avatar ceoloide avatar

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.