I am trying to get skylanders off of eBay but I am not sure which one to buy because some of them don't have online codes and I don't know if it matters.
It looks like you do need an activation code in order to play online in Skylanders Universe see here. I'm not sure if codes can be re-used, so you're probably be better off buying codes for online play firsthand.
However, there are a bunch of other Skylanders games, none of which support online play, and which don't require activation codes.
If you want to play online, you have to play Skylanders Universe and you probably shouldn't buy codes on eBay because they might not work. Any other Skylanders game should be fine, because they don't support online play, and don't need codes.
TL;DR Don't buy anything with a code from eBay, it may not work.
you don't need them unless you play spyro's universe with them. And even if you do play that, you can attach your portal to your computer and use that for spyro's universe.