Boil open pots of water on your stove until nearly all of the water has boiled off. Do this every other day if your home is slightly dry and if the static shock in the carpet doesn't happen often. Boil pots of water every day if your home feels very dry and if static shock occurs often. Boiling water will force water vapor into the air and will moisten the carpet over time. Don't boil the water until it's all gone because this can damage your cookware.
Use a humidifier in your home if the static shock continues. Use the humidifier every day to add moisture to the home, but stop using it as soon as you notice condensation on windows or walls.
Fill a spray bottle with anti-static solution, and mist it over your carpets if static still remains. This solution will prevent electric shock. Once applied to the floor, these anti-static solutions can last 6 months to a year.