1
1 Comment

How I build my website analytics in 30 seconds and for free

As I am releasing the beta of my language learning app (https://lang.blue)
I am posting the link to my app at various places and send it to people and the question for me is know:

Where do people click on my link?

Okay now I need to integrate analytics. Or do I? I kind of don't want to use google analytics because its difficult with the GDPR and very complex.
There are good solutions but I don't want to pay another subscription just for getting to know where people come from on my site.

How do these analytics services actually know where people come from?
Turns out there is this simple property of document

document. Referrer

it returns a string of the last page the user was on before clicking on your link like:

https://t.co/

it does not work in 100% of the cases, especially if somebody goes directly to your page but it is enough to get a rough idea where people come from.

I paired this up with a cloud function (I am using firebase)

exports.referrer = functions.https.onCall(async (data) => {
  let obj = {};
  const FieldValue = require('firebase-admin').firestore.FieldValue;
  obj[data.ref] = FieldValue.increment(1);
  await db.collection("analytics").doc("referrer").set(obj, {merge: true});
  return {"code":201};
});

this takes the link and increases a number by one every time somebody comes from that source

{
    "https://t.co/": 2,
     "https://www.youtube.com/": 2,
}

and the frontend simply calls my endpoint with the information

const addReferrer = httpsCallable(functions, 'referrer');
addReferrer({ref:document.referrer});

this literally took a minute, is completely free and gives me an idea where people are coming from and for the moment that is pretty much perfect

edit:
somebody clicked on the link :D

{
https://www.indiehackers.com/post/how-i-build-my-website-analytics-in-30-seconds-and-for-free-1501687d68: 1
}
  1. 0

    I never believed this could be possibly done but he proved me wrong by providing a good result which made me and my family happy. We are forever grateful to him for the excellent job you and your team pulled out because we suffered a lot due to this low credit score, but now we can get everything we want (Loans, Credit card, getting approved for higher limit, mortgage others). Reach out to him on the mail above to get your credit fixed right now to avoid been scammed by all the fake credit repair agencies again. Feel free to thank me later! Contact info [email protected] or Text him at +1(740) 214-6282.

Trending on Indie Hackers
Competing with Product Hunt: a month later 33 comments Why do you hate marketing? 29 comments My Top 20 Free Tools That I Use Everyday as an Indie Hacker 18 comments $15k revenues in <4 months as a solopreneur 14 comments Use Your Product 13 comments How I Launched FrontendEase 13 comments