如果共享源是通过Facebook或Twitter测量病毒系数

So the standard way of measuring the viral coefficient is via email addresses i.e. current user xyz@xyz.com invites 10 people via email so that you have their email addresses and can tell how many signed up and can therefore calculate the viral coefficient.

How would you calculate and program for the viral coefficient if the current user xyz@xyz.com shares a link on your page to facebook or twitter because you wouldn't know how many people they have invited or have their email addresses. Even if you put an estimate of say 100 people referred to your site, how would you know if the new user was referred from user xyz@xyz.com?

Give every user a custom link like : example.com/register?refer=foobar

Whenever anyone registers, look for the GET parameter refer and you will know who referred this new user.