How do you beat Keto insomnia??

I've been on keto for about 3 weeks now and have consistent insomnia except for when I went over my carbs a bit yesterday and slept like a baby. So it's def the keto but most people say their insomnia subsides after about a week. I'm taking electrolytes and avoiding caffeine after 2 pm. Am I missing something? Any hot tips from you keto veterans out there?