The state of California boasts some of the most gorgeous campgrounds in the United States. And boy are they popular.

The trick to booking a site is planning ahead or using automated email alerts (state parks only) to let you know when a vacancy opens up.

Plan Ahead

Planning ahead means knowing when you can first book a campsite. For state and national park campgrounds in California, you can generally reserve a campsite 6 months in advance. To book a site in a popular campground you need to be logged into one of the online booking systems six months from the day you want to camp.

For the most popular sites, you’ll want  to have your ideal site chosen and ready at the precise hour the sites become available for booking. You can also call to make a booking, but by the time your call get’s answered, all of the best sites may have been booked online.

For instance, I recently wanted to book a site in April 2016 at San Elijo State Beach Campground, a beachside campground in Cardiff, California. On October 1, 2015, I found the campground map on Reserve California the site that handles California state park bookings) identified a site fronting the beach in the list on the site, picked a date in late April.

Then I waited. At exactly 8 a.m. PST (the time the booking period for California state parks opens), I clicked on the site and–guess what?–it was already booked. I quickly opened the full campground map to see what was available, and there was only one beachfront site left. I managed to snag it.

If I’d wanted to book a site in May, I’d need to do the same thing in November of the year before. Not all campgrounds fill up this quickly, but many do, especially if you’re looking for a premium spot.

For booking national park campsites, online booking on Recreation.gov opens at 7 a.m., the same time the call centers open.

Using Email Vacancy Alerts

If you slept in and missed the opening to book a great campsite, another option is use Reserve America’s email alerts system to inform you when a site opens up.

This system let’s you pick a campground and a date, then sends an email if someone cancels their reservation. Typically, you need to move quickly after you’ve received the email or the site will book up again.

Unfortunately, I always seem to receive the alerts at 2 a.m. and the spots are already taken by the time go online, but that may just be bad luck.