DEV Community

_s._hyn
_s._hyn

Posted on

I tried tracking social media traffic with 17 redirects and here's what actually happened

I sent the same link to three Slack channels last Tuesday and realized I had zero way of knowing which one drove the 47 signups I saw that morning. Honestly, it was a bit of a wake-up call - I had been relying on general analytics, but I needed something more specific. I was using 17 redirects to track different social media platforms, but it was getting out of hand - I had no idea which platform was actually driving traffic to my site.

Why Manual Tracking Failed Me

I was trying to use a combination of curl requests and manual redirects to track which social media platform was driving traffic to my site. My thought process was that if I could just create a unique redirect for each platform, I could track which ones were working. I wrote a simple Python script to generate the redirects and update my social media posts accordingly:

import requests

def generate_redirects(platforms):
    redirects = {}
    for platform in platforms:
        # Generate a unique redirect URL
        redirect_url = f"https://example.com/{platform}"
        # Create a redirect from the short URL to the original URL
        requests.post(f"https://example.com/redirects", data={"from": redirect_url, "to": "https://example.com/original"})
        redirects[platform] = redirect_url
    return redirects

platforms = ["facebook", "twitter", "instagram"]
redirects = generate_redirects(platforms)
print(redirects)
Enter fullscreen mode Exit fullscreen mode

But, as I soon realized, this approach was not scalable - and it was also prone to errors. I was spending more time managing the redirects than actually analyzing the data.

The Spreadsheet that Saved My Sanity

I decided to try a different approach - I started using a URL shortener to track my links. I was looking at the device breakdown in LinkCut and noticed that most of my traffic was coming from mobile devices. This was interesting, because I had assumed that most of my traffic would be coming from desktop devices. (I mean, who fills out forms on their phone, right?) But, as it turns out, my audience is actually quite mobile-savvy. I also noticed that I could set a custom slug for each link, which made it easier to keep track of which link was which. And, as an added bonus, I could generate a QR code for each link - which was useful for offline promotion.

What I Actually Learned

The results were surprising - I had expected to see a lot of traffic coming from Facebook, but it turned out that Twitter was actually driving more traffic to my site. I also noticed that my traffic was spiking on certain days of the week - which was interesting, because I had assumed that my traffic would be more consistent. Look, I'm not sure if this is just a quirk of my specific audience, but it was definitely something that I hadn't anticipated. The thing is, I still don't fully understand why my traffic is spiking on certain days - but at least now I have some data to work with.

When This Approach Falls Apart

Honestly, this approach is not perfect - there are definitely some limitations to using a URL shortener to track your links. For one thing, it's not always possible to get a complete picture of your traffic - especially if you're dealing with a lot of redirects. I mean, think about it - if someone shares a link on social media, and then someone else shares that link, and so on... it can be hard to track where the original traffic is coming from. And, of course, there's always the possibility that someone will share a link that's not using your URL shortener - which can make it even harder to track your traffic. I'm not sure this is the best approach, but it's worked for me so far.

I've been using LinkCut for a while now, and it's been helpful for tracking my links. Has anyone else hit this exact wall, and if so, how did you overcome it?

Top comments (0)