Bumblebee was a prequel set in 1987. It ends with a glimpse of Optimus in truck form on Earth but doesn't show him interacting with humans at all. (Prior to that scene, we only see him as a robot on Cybertron at the very beginning.)
As far as I'm aware, the Bay films were all meant to be...
I haven't seen the movie yet, and am not in any Transformers groups. My understanding is that the movie takes place between Bumblebee and the first Bay film.
However, if that's true, it does leave me questioning how the public didn't know about the Autobots or Decepticons until 2007. I can...