For what it is worth...
I have done this several times on different trailers and have always gone to a carpet store here in Iola and picked up some carpet glue and apply it to both the wood and carpet. Never have used staples but I suppose it wouldn't hurt. I have always used treated lumber and make sure you draw the carpet down tight. Don't really want to saturate the glue on either surface but apply it moderately. The glue I get comes in pints and have found it to be useful for other things too.
Sacred Heart of Mary, pray for us now, and at the hour of our death. AMEN
For those who believe, no explanation is necessary....for those who don't, no explanation is possible
For the sake of his sorrowful Passion, have mercy on us and the whole world