dojap

dojap

Do you use Google Analytics with Phoenix?

Especially for personal projects where you don’t need to show Google Analytics numbers to your company and stuff, I really think that for tracking users activity, what they click and when etc. Pheonix LiveView is nice.

For example, more and more people are using adblockers, so, the Google Analytics numbers are screwed, which is a non-issue with a server side solution.

But my concern is about performance. Logging every action in the database could be a lot after time and with a lot of users. What is your experience when it comes to performance and logging every action/click/pageload of users, or at least, registered users?

Or should I use some external open source server side solution?

First 8 of 8 Posts Switch mode

c4710n

c4710n

Google Analytics not only can be used from client-side, but also from server-side.

Check out Server-Side Tracking in Google Tag Manager. In this way, you don’t store any action in your database, but the online service, just like using client-side tracking.

wmnnd

wmnnd

If you don’t have millions of users every month, a naive approach with a regular Postgres or MariaDB instance will probably handle your logs just fine. If you don’t care about permanently persisting these logs, you could also build something using ETS tables.
If you want something more sophisticated built in Elixir, you could give Plausible a try :slight_smile:

dojap

dojap

Seems like too much hassle. At that point I would rather opt for something completely opensource like, I don’t know… I mean why not to write your own tracking for specific things you need and dismiss everything else?
I reiterate, I am talking mostly about personal projects, not about commercial businesses where people EXPECT Google Analytics so they can feel well and talk about with their managers and marketers during lunch.

dojap

dojap

I have no idea what are ETS tables, but I will definitely check Plausible.

wmnnd

wmnnd

ETS is a very performant in-memory storage system:

c4710n

c4710n

Get it.

If I have such requirement, I will

  1. Implement my own tracking services.
  2. Use some open source alternative, and host it in my own domain.

I prefer option 2. After all, the business is where the value comes from. Tracking is not the core service.

dojap

dojap

Interesting, so via ETS I could store stuff in memory and perhaps once a day or week (I have no idea how much stuff it can hold) do a dump in a file on a disk that can be accessed via admin or put offline when necessary.

It seems nice, I will explore it further and perhaps abandon the idea of storing the clicks and actions of users in the PosgreSQL database altogether. Storing analytics in database seemed like too much bloat when what you need most of the time is just real time overview of what is happening now on your page and perhaps a few hours or days back. And the long term ego-boosting looks at the page views you do perhaps once a day or a few times a week - so, it can be compiled from files on the disk when you need it.

Thank you very much for the idea of using ETS for analytics.

edisonywh

edisonywh

Dashbit has some articles on building a homegrown solution - Homemade analytics with Ecto and Elixir - Dashbit Blog, though I just use Plausible (they’re built in Elixir so I’m happy to support!)

— All posts loaded —

Where Next?

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 91561 914
New
byu
@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project. My initial shotgu...
New
arcanemachine
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
AstonJ
Just a general thread to post chat/news/info relating to AI/ML stuff that may be relevant for Nx now or in the future. Got anything to sh...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
bjorng
We want to introduce a new native datatype to Erlang: native records. Although replacing all tuple records with native records is not our...
New

We're in Beta

About us Mission Statement