An electrocardiogram (ECG or EKG) is a record of the electrical activity of the heart over a period of time. It was invented by Willem Einthoven. It is done by electrodes attached to the outer surface of the skin and recorded by a device outside the body.