Sabie
Sabie

Reputation: 87

Identifying unique users in server-side tracking

I'm now learning about server-side tracking (as opposed to client-side), and I can't understand how the identifying of a unique user is done, when we use server-side method? What I find on the internet, is only this phrase "unique id is generated and then mapped against a user every time they take actions". But I don't understand what originally allows to create this "unique id" in such a way that it is unique for every unique user.

Could you please share this in some broad terms - without a specific code, just the working principles and mechanics?

Thank you!

Upvotes: 1

Views: 416

Answers (3)

Andy  Gee
Andy Gee

Reputation: 3345

Ideally the user would be performing some type of login with private and unique credentials but presuming that's not the case here, here's some additional possibilities.

What you need to decide is "how" unique each user will be, often, just the IP address of the connection to the web server is enough to discern a unique user however that's not always enough - for example an office with many users sharing the same public IP address would be detected as the same user.

So the next compounding factor is using cookies or local storage to differentiate between the office users in this example. Each user would have a unique cookie ID and combining that with your IP address you can again differentiate each user.

Sometimes that's also not enough/possible. For example if cookies are blocked or the IP address changes frequently though dodgy networking not respecting sticky sessions etc.

The next "layer" might be device fingerprinting. In order to identify unique users through fingerprinting you will likely need some javascript. Generally speaking you get the javascript to perform actions such as detecting discernible metrics (font list, screen resolution, browser properties etc) and then send those to the back end via any means necessary - this could be via ajax, loading specific images or even redirecting the page.

It is possible to do this without javascript but it's a more difficult - this can even be done with DNS, through redirections.

Depending on your use case you can use any combination of the above or get inventive. The most reliable way is by getting the user to authenticate though.

Upvotes: 0

Stape Team
Stape Team

Reputation: 1

In the example with Stape's User ID power-up, the unique ID is generated and added to the Request Header for each Incoming Request inside the server Google Tag Manager once the Incoming Request is detected.

The ID is generated and added to the request on the Stape's side.

Upvotes: 0

jdwyah
jdwyah

Reputation: 1292

My suggestion would be to use a cookie to store it while the user is anonymous. Then save it on the user when the user is created.

The tracking_id itself can just be a GUID. Pseudo-code:

def tracking_id
  @tracking_id ||= user.try(:tracking_id) || cookie_tracking_id || Guid.new
end

This will let you see a consistent activity stream across the signup divide.

I have some more thoughts in https://prefab.cloud/blog/opinionated-simple-identification-and-tracking-of-users/

Upvotes: 0

Related Questions