Here’s the Problem…
Google Analytics is a great tool for collecting data about how users interact with your websites and apps. But what if you want to combine this data with information that can’t (or shouldn’t) be collected alongside events?
GA4’s Data Import functionality solves this problem by allowing you to upload CSV files comprising useful or sensitive information, such as e-commerce product metadata, lifetime customer value, or offline events. While this could also be accomplished further down your data pipeline, adding information directly to GA4 makes it available for use in segments and/or remarketing lists, which is useful to both analysts and marketers.
Out of the box, Data Import supports one-off, manual uploads, which are fine for some use cases but aren’t suitable for long-term, repeated use. Your next best option is to use an SFTP (Secure File Transfer Protocol) server where you can upload files, then ask GA4 to check it for new files on a daily, weekly, or monthly schedule. Unfortunately, not everyone just has access to an SFTP server, and it would require a lot of technical knowledge to set one up, right? Wrong!
…And Here’s the Solution
We’re happy to announce our new, open-source Terraform project that makes setting up an SFTP server a breeze. All it requires is your own GCP (Google Cloud Platform) project, a local installation of Terraform, a copy of our GitHub Repository, and a handful of GCP permissions.
Using this solution will spin up a secure, GCP-hosted SFTP server that satisfies GA4’s prerequisites for connecting to an SFTP data source. Once that’s ready, you can upload CSV files to it yourself or set up your own automation for uploading files. And where do the files go? You can rest easy knowing that your uploads will live in the security of your own Google Cloud Storage bucket.
How Do I Set It Up?
The process is explained in more detail in the repository's README, but here’s an overview of the steps:
1. Clone the GitHub Repository
2. Do some prep work, like:
- Installing Terraform
- Deciding whether to use a custom domain
- Generating a key file for logging in (don’t worry, it’s simple)
3. Update variables in the configuration file
4. Run a few Terraform commands to make the magic happen
5. Configure GA4 to connect to the new server
After you’ve finished the setup, your SFTP server will continue to run on GCP, and GA4 will be able to access any files you upload - as long as they match your Data Import configuration settings in the GA4 Admin UI.
OK, I Have Some Questions
We’ve tried to anticipate some of your questions in the GitHub FAQ, but honestly, it’s hard to guess every question that might arise when we’re fully immersed in the project.
If we’ve missed something, please open an Issue with the `question` label. If it’s broadly applicable, we might even add it to the FAQ!
And It’s Open-Source?
It sure is. Please feel free to explore the GitHub repository and try the tool out, then let us know if you have any feedback or suggestions for improvement.
Adswerve provides BigQuery consulting and training for teams around the world. To learn more, don't hesitate to get in touch with us!