Best way to detect environment

See this thread. How to Exclude Google Analytics When Running Under Hugo Local Server

Particularly @budparr 's contributions.