Raw event export
Insights can put a copy of every visit, page view and click it records for your company's websites and apps in an Amazon S3 bucket in your own AWS account, every night. Use it to keep your data longer than the 25 months Insights keeps it, or to analyse it with your own tools, such as Amazon Athena.
What you need
- An AWS account and an S3 bucket in it.
- Someone who can create an IAM role in that account.
- The Insights admin permission (Admin / Finance has it) and access to every brand: the copy covers every site and app.
ASTRO CSM never asks for a key to your AWS account. You create a role that ASTRO CSM may use, for your bucket only, and you can remove it at any time.
Set it up
- In the menu, open Insights, then Raw event export, and select Start set-up. The page shows ASTRO CSM's principal and your external id, a code only your company has.
- In the AWS console, open IAM and create a role. Its name must start with astro-insights-export, for example astro-insights-export. As its trust policy, use the Trust policy shown on the page (it names ASTRO CSM's principal and your external id). As its permissions, add the Permissions policy shown on the page: it lets ASTRO CSM list, write and delete files in the folder you choose, and nothing else.
- If your bucket is encrypted with your own KMS key, also let the role use that key (kms:GenerateDataKey and kms:Decrypt).
- Back on the page, under Your bucket, enter the bucket's name, a folder if you want one, the bucket's region, the role's ARN and the first day to copy, then select Save.
- Select Test connection. ASTRO CSM signs in to your role, writes one small file in _astro-connection-test, checks it can list the folder, and deletes the file again. Each step says whether it worked and, if not, what to fix.
What is copied, and when
- Every night, everything recorded up to the end of the previous day (UTC) that is not in your bucket yet. Today's events follow tomorrow night.
- The files go under events/ in your folder, one folder per site or app, day and hour (property=…/dt=…/hour=…), in Parquet, the same layout Amazon Athena reads. Other files in your folder are never touched.
- The first copy of a long history is spread over several nights: each night copies up to 5,000 files or 20 GB.
- Choosing an earlier first day later copies the earlier days too. Turning off Copy my events every night stops the copying; the files already in your bucket stay yours.
Visitors you erase
When you erase a visitor (Privacy requests), Insights replaces the files that held them. The next night, the export removes the old files from your bucket and copies the new ones, so your copy no longer holds the visitor either. This needs the delete permission in the role's permissions policy. Without it, the history says how many files could not be removed: add the permission and they go the next night, or delete them yourself. Files older than about two years are no longer in Insights, and the export leaves them in your bucket as they are.
History
The History lists each night's copy and each connection test: when, where to, how many files and what was wrong, if anything. A failed night loses nothing: the next one copies whatever is still missing.
Good to know
- The copy is done by a background task that the ASTRO CSM team turns on; until then nothing is copied.
- Storage in your bucket is billed to your AWS account. A bucket in another region than ASTRO CSM's may also cost transfer.
- To use the data in BigQuery or Snowflake, load the Parquet files from your bucket: both read them.