Optical bandgap means bandgap estimated using optical means or
characterization. In simple words, let a light of different
energies incident on the material. The material absorbs some
energies and transmits some energies (the detector measures this).
The threshold energy at which the material starts absorbing light
is "Optical Bandgap".
In a similar manner, electrical bandgap means bandgap estimated
using electrical means or characterization. Here instead of
measuring what light is observed of transmitted. You make
electrical contacts for the material and measure the current
instead of optical absorption. The incident light is of course
absorbed, and carriers (electrons and holes) are generated in
proportion to absorption. We measure current (nothing but charge
which is proportional to absorption) and this current too shoots up
at a threshold energy i.e. electrical bandgap.