The first film poses an interesting question in retrospect: if the Decepticons were able to learn about Sam Witwicky’s ancestral connection to the Allspark and the Decepticons, then how was Bumblebee able to learn about it? Did Bee also hack into some government mainframe and get similar info, which eventually led him to Sam?
The internet I am sure. Probably the same way most of the Transformers learned about everything on earth.. which in some ways is kind of.. embarrassing for humanity. Just thought of that too lol
Sam: "How'd you know about my grandfather's glasses?" Optmius Prime: "eBay" Probably pretty much the same way the Decepticons found Sam. Rapidly searching Earth's recorded information eventually leads to records of a mechnical alien being found... which leads to Cpt. Archibald Witwicky... which leads to eBay listings for some of his belongings... which leads to Sam.
Ebay, Sams account, online Sector 7 newspaper clippings showed the discovery of Iceman. same way the Decepticons found him.
according to the the comics Bumblebee himself learned of the Witwickys when he researched about alien encounters, when learning of witwicky encounter with Megatron, he spent many years in earth searching for all decendants. while (not stated in the comics) it is indeed likely optimus and the others learned of sam thru ebay as seen in the movies
The Autobots seemed to have looked at Sam's Ebay page and noticed the cybertronian markings on the glasses. They also seemed to have found out about Captain Witwicky's encounter with Megatron. They however didn't seem to know about Sector 7, nor that they had Megatron and the Allspark. The Decepticons did, but they had to break into Air Force One and hack the US government mainframe directly to learn that.
In "Transformers: Autobots" for the DS, the player character scans some radio towers to access the internet, and somehow is able to learn about the glasses (Sam Witwicky is not mentioned in the game), which he later tells Bumblebee about. BB explains (via text messaging) that the glasses have the runes on them (presumably the photo was high enough quality for him to make them out). Then, in the opposite version: "Transformers: Decepticons", one of the early missions involves the player character chasing down BB. Completing the mission has the player character retrieving data from BB about an old news article about an unspecified arctic expedition (again, no Witwicky connection in the game). Since the game is somewhat following movie cannon (in one Autobot mission as BB chasing Barricade, the con hijacks the police radio and sets the human authorities on 'Bee by describing BB's holodriver driver...which is an apt description of the guy who played the holodrivers for both Blackout and Barricade in the movie itself. Said guy was in fact going to be used as BB's Holodriver in the movie in an earlier scene before becoming Sam's car, but the scene was cut), it's reasonable to assume that how these games depict BB gaining the information is somewhat how he was originally intended to learn about Sam in some way.