Google Cloud Storage

Send your Attribution data to Google Cloud Storage for more detailed analysis

Attribution can deliver your data export to a Google Cloud Storage bucket, from where you load it into the database of your choice. What each table contains is on Data schema.

Google Cloud Storage
📘

This article is for a Google Cloud admin or DevOps

The steps grant a service account write access to one of your buckets. Make sure you understand each step before you run it.

Create a service account with access to the bucket

  1. Log in to the Google Cloud Console.
  2. Create a new service account in your project with the "Storage Insights Collector Service" role, roles/storage.insightsCollectorService.
  3. Create a key for the service account and download the JSON file.
  4. Create a bucket, or pick an existing one, in the same project. Keep it for this data alone.
  5. Add the service account to the bucket's policy with the "Storage Object User" role, roles/storage.objectUser. See IAM roles for Cloud Storage for what the role grants.

Check the access

Confirm that the service account can upload to the bucket. In Cloud Shell:

$ gcloud auth activate-service-account --key-file=YOUR-SERVICE-ACCOUNT-KEY.json
Activated service account credentials for: [[email protected]]

$ gcloud projects list
PROJECT_ID: xxxx
NAME: xxxx
PROJECT_NUMBER: xxxx

$ echo "upload test" > test.txt
$ gcloud storage cp test.txt gs://YOUR-CLOUD-BUCKET/
Copying file://test.txt to gs://YOUR-CLOUD-BUCKET/test.txt
  Completed files 1/1 | 12.0B/12.0B

$ gcloud storage cat gs://YOUR-CLOUD-BUCKET/test.txt
upload test

If the last command prints upload test, the permissions are right.

Set up the export

Open Settings → Data Export, choose Google Cloud Storage and enter:

  1. The bucket as a full URL with the gs:// prefix, for example gs://my-attribution-export.
  2. The contents of the service account's key file (JSON).

Save, and the first files land with the next daily run.


What’s Next