The best time to change your shock absorber will depend on the brand of truck you are driving, as well as on the terrain on which you are driving it. The manufacturer will very likely provide one or two pieces of advice on when best to change your shock.
Seeing as most trucks come with standard shocks, you can reasonably expect the shocks to last for as long as 100,000 miles before they require changing. If the terrain on which you drive is very rugged, you will be better off changing your shock absorber after about 50,000 miles. Or, you can usually change your vehicle’s shock absorber every five years.