Recently, several excellent tools for importing costs into GA4 have emerged, such as GA4DataImport.com. We decided to try our hand using the resources we already have. That means, we pull the costs into a Google Sheet, convert them to CSV in Make.com, upload them to our server, and then download them via SFTP.
We’re in the testing phase, and managing the server is proving to be our biggest challenge. However, establishing a basic proof of concept (using root access – every server admin out there just cringed) is actually quite straightforward. If you’d like to test with us, here’s how you can proceed.
1. Upload costs to Google Sheets using the script from cost-import.cz, Supermetrics or similar
There’s already a lot written about this, and the cost-import.cz website itself provides good tutorials (Google Translate will work). You’ll definitely manage this phase. You can also use Supermetrics, PowerMyAnalytics or DatasLayer sheet import if you are used to them.
2. Set up and configure a virtual server that supports SFTP
There are countless options for setting up such a server. Prices range from a few cents to thousands of dollars monthly. A sleek option is to establish a server using Google Cloud, or you can even choose a distribution from the Marketplace and get it installed and operational with a single click. With this, you can pay only for what you actually use without reserving any power. The issue here is the potential for hefty costs without proper configuration experience. It has even become meme-worthy, with a notable one by The Developer on Facebook:
So, I took the path of least resistance. I ordered a Wedos VPS SSD for 7 USD/month and even found a voucher online for a 33% discount.
I had Debian 10 installed. But it likely doesn’t matter much for this purpose. The configuration required is really minimal.
We’re now at the stage where we’ve found a vendor who assisted us with accounts, groups, permissions, and additional security (they don’t want more jobs), but basic configurations are manageable by anyone with online guides.
I recommend familiarizing yourself with the basics: how to work with SSH, how to connect, understanding keys, basic shell commands for handling folders and files, and generally navigating the server environment. If you’re a complete novice, these basic commands should suffice:
- ssh root@serveripaddress followed by the password – and you’re on the server.
- mkdir ~/costs/ – creates a /costs/ folder in the user’s home directory where you’ll be uploading.
- Then, I need to upload the GA4 public key – follow this guide, specifically the Copying public key manually section.
- A common recommendation from every server admin is to always log in with a key. Generate one for yourself, disable password logins – though for a proof-of-concept, uploading the GA4 key is enough.
At this point, you just need to get the CSV file with costs into this directory. For this, we use Make.com.
Tip: If you’d rather avoid SSH entirely, another option is using Wedos Managed Server, where you can create users, including keys, within the user interface. Prices start from 28 USD/month. PS: I’m not being compensated by Wedos. There are certainly other providers who could handle this, but we needed the cheapest, easiest, and quickest solution. And in my opinion, Wedos wins here.
3. Set up cost import in GA4 using the SFTP method
For the server address, I’ll use sftp://220.127.116.11/ home/user/costs/cost_file.csv (replace with your IP address and your path). If experimenting with root, it’ll be sftp://18.104.22.168/ costs/cost_file.csv (remove the space).
Don’t forget to map the data – the default column selection is different from the output from cost-import.cz.
GA4 will then generate a public key for me, which needs to be added to the server. So far, it seems to always be the same, so you’ll only need to do this once.
4. Scenario in Make.com for converting Google Sheets to CSV
I’m sure I haven’t used the best method here, but I couldn’t find another way. We aimed for the fewest operations to fit within the free tier – and we managed to stay within it. The entire sheet-to-CSV process counts as a single operation, regardless of the number of rows.
Here are the steps for my configuration:
- Subsequently, I need to align the scheduling and have a backup plan.
- For instance, cost-import.cz runs at 6 AM.
- CSV to sheet at 7:30 AM.
- And the GA4 import between 8 – 9 AM.
Now, you can click on “Import now” and hope for a successful outcome:
Subsequently, you can admire the costs directly in the interface. I’m even surprised by the processing speed; in this case, it took only 30 minutes, and so far, it’s always been within a few hours.
Tip: I also tried using Google App Script for exporting to CSV. ChatGPT can even generate a complete functional code. However, I still have to somehow get it to the server. The problem here is that AppScript currently doesn’t offer any sensible method for importing to the server, except for exposing the file online. This seemed too risky, but it would have eliminated this entire step.
Tip2: In this guide on calculating MER in GA4, 6clickz uses Keboola instead of Make.com in this step.
How much does this all cost?
- Costs for cost-import.cz are 26 USD/connector per year.
- The virtual server is approximately 70 USD/year.
- Associated work: Currently, I can add another account within minutes. Setting up a functional concept took me two sleepless nights, but otherwise, it can be accomplished in 1-2 hours.
- Server updates: We’ve enabled automatic updates for the server. We’re using such basic functions that hopefully nothing will break.
- Problem and error resolution: That remains to be seen.
Compared to other services, which charge hundreds of crowns per account and handle everything for you, this approach may be worth it if you want greater control over the import or have a larger number of accounts.
We’re currently piloting this with several clients. Everything seems to be functioning well so far. But the biggest projects are still waiting for deployment. We’ll be pleased if we can inspire someone. Whether here in the comments or via email at firstname.lastname@example.org, we’d love to exchange a few experiences.
I’m still contemplating whether to implement this everywhere. I’m not familiar with GA4’s roadmap, but the current method of cost uploading is quite impractical. I believe that sooner or later, Google might add an API import option, making all this workaround essentially redundant. I’d appreciate any insights or behind-the-scenes info from you all.