You will earn plunder from any successful action on an eb, be it a hit (attack), assa, steal, scout or item, depending on the respective phase.
Hits will give you an immediate payout of gold as well as an end bonus payout at the successful end of the eb (50% of the direct payout). This is basically how you'll earn most of your gold as a hitter. To maximize your earning as a hitter, you'll preferably skim your troops.
A hansel (basically a spy build with one troop building) or a spy however will do decent gold by attacking (no need to skim troops there as you'll always get about the max ally bonus plunder) and get the largest part of your gold as end bonus payout coming from your successful spy actions. Assassinations won't give you immediate payout, however they will give you a nice end bonus payout (depending on the eb). To maximize your earnings as a spy build, attack away but skim your spies (as a hitter would do with his troops).
Do not forget to always have enough gold invested in allies to ensure you get the maximum ally bonus plunder.
Pure troop or spy builds are not recommended for ebs, as you basically just lose half of your possible actions (and some associated plunder).
The biggest plunder killer are towers of any sort. Avoid those in your growth phase and if you never intend to engage any PvP action (it doesn't mean that it won't happen though).