Spawners and eggs are used separately. You place the spawner and it's a normal pig spawner, then you left-click with the egg on the spawner and it turns the spawner into that mob type. You must have both, unless you only want a pig spawner.
This cannot be used with hostile mobs, slimes, or squids.