At the start of most poojas, I've seen the sloka "śuklāmbaradharam viṣnum..." being chanted with the hands tapping the sides of the head. Some books specify that the sides of the head to be tapped 5 times.
Any scriptural basis for this?
We come across people striking one’s own head with knuckles while prayer to Ganesha in temples and other sacred places. The story and reason of worshipping Ganesha by striking head with joints of fingers when the fist is closed is associated with the origin of the Kaveri River.
Legend has it that Sage Agastya was carrying Holy Ganga River water given to him by Shiva in a Kamandalu. He reached the southern part of India which was under a severe drought.
He paused to take rest. He placed his Kamandalu beside him and soon fell asleep.
Ganesha in the form of a crow arrived there and knocked the Kamandalu down. The water inside the pitcher started flowing through the drought-stricken land and it became the Kaveri River.
The sage on waking up tried to chase the bird away which then transformed into a small boy. Sage Agastya ran after him intending to strike him on his head with his fist.
After running for awhile, the body assumed his divine form.
Sage Agastya was full of remorse and began to strike his own head with his knuckles.
Ganesha stopped him and declared that henceforth all those who worshipped him in this manner would be graced with wisdom.