A person who is neither a citizen, nor a resident in the US (a US non-resident alien), has a website which brings him some income, for example from Google AdSense.
In what cases would this person have to pay US income tax as a non-resident alien to the IRS? This question is only about the tax liability to the US, not about any taxes the person has to pay in the country where he is resident.
This IRS page says that:
A nonresident alien (NRA) usually is subject to U.S. income tax only on U.S. source income. The general rules for determining U.S. source income that apply to most nonresident aliens are shown below:
and there is a nice table, which says that the factor determining source is "Where services performed".
Which doesn't explain me much, as how does one determine where are services provided by a website performed? Is it based on where is the person developing this website located or where is the server hosting the website located, or something else?
The person itself was not physically in the US when developing this website.
Please also explain cases when the person visits the US for a short time (for example a weekend) while this website is online (for reasons unrelated to the website, for example attending a conference).
What if the person while visiting US, notices that his website is down, and logs in to the server to restart it? Does that small event make him liable to US income tax on the whole income from his website?
Or maybe it all doesn't matter, because Google is a US company and any income received from a US company is US-source income anyway?
What if the income is not from Google AdSense, but a webshop selling something to customers worldwide? Does it matter if he has any US customer buy something from his website?