wrap in a closure

to make sure no globals are leaked, and to
guard against invoking .page() twice
test: window.analytics -> analytics
refactor
Merge pull request #17 from segmentio/v3

V3