How does it "won't work"? Is it undefined or does it give you erroneous values?
If the visitor is coming from a link on an external page, it should be giving you that value when it has a value. But it won't always have a value, and when it does that value won't always be accurate.