Typical bombing altitude for RFC/RAF stuff like the DH4 and DH9 appears to have been around 6,000 feet from what I can gather. But I imagine the accuracy of level bombing from that altitude with the sights they had back then can't have been spectacularly pinpoint on anything smaller than a marshaling yard, so I would guess they went lower for smaller targets. They would probably transit to the target at a higher altitude though, theoretically that could be over 20,000, but with a heavy bomb load, a DH4 or DH9 would be struggling at much over 15,000 feet.
Certainly when bombs were slung below fighters like the Sopwith Camel, they would bomb from extremely low altitude, and there are instances on record of troops being run down by the undercarriages of aircraft on such missions. Later in the war the Germans started making stuff better suited to trench fighting, such as the all-metal aircraft types from Junkers, since at that height, everyone would be having a potshot at you, as the Red Baron found out (possibly to his misfortune).
Obviously for stuff like Zeppelins and heavy bombers, both the night and altitude would have been their friends, and until the war started throwing up fighters which could make the altitude, and ammo that could set them alight, Zeppelins had been fairly immune to attack at anything over about 10,000 feet. Later on they were very vulnerable, with even Count Zeppelin himself saying they were antiquated weapons by 1917. Later in the war, both the DH9 and the DH4 were used for anti Zeppelin patrols on home defence duties, and since the DH9 sometimes struggled to get over 14,000 feet, in the variants with crappy engines, but could generally make it over 20,000 feet, that would suggest they could get above a Zeppelin, or there would have been little point in assigning them to such duty.
Altitudes for two-seater reconnaissance and artillery spotters, as opposed to balloons, would depend to some degree on the mission at hand. Obviously you can photograph more area if you get up higher, unless taking an oblique angle shot, but lower down you get more detail - which might be the purpose of the mission - such as to see whether an artillery barrage has managed to destroy some barbed wire or whatever. Cloud cover would also be a factor too, and in Europe over the western front, it is fairly typical to have cumulous clouds forming at 3,000 feet, which would obscure the view of the ground, this is why a lot of observation balloons would not be much higher than 5,000 feet and usually lower than that.
Much of the same is probably true of artillery observation, which certainly required good visibility on both sides of the lines. The crew of the aircraft would obviously have to observe where the rounds were landing, but they'd also have to be able to see the artillery batteries, which invariably signaled to the observing aircraft with panels laid out on the ground. Given the need to see stuff clearly on both sides of the lines, and the fact that clouds might be an issue, I would say that you'd be looking at between 3,000 and 6,000 feet as an ideal altitude range for that sort of thing, which of course is why it was - and indeed still is - a risky proposition and one of the reasons why armies are now using pilotless drones such as the Predator UAV for that kind of stuff.
Judging by the autobiographies and combat reports I've read from WW1 flyers, it seems patrols got a lot higher as the war progressed, with things starting at around the 5,000 feet mark very early in the war, and by the end of the war being up nearer 18,000 feet.
Eddie Rickenbacker - in his
Fighting the Flying Circus bio - mentions being at 15,000 feet a lot in the Nieuport and having trouble getting very much higher than that without spending a long time to climb further. He probably went up higher than that with the SPAD, since it was a 'boom and zoom' kind of fighter, and unlike the Nieuport, it could really dive at very high speed, but in both instances, that was fairly late in the war.
Bill Lambert - in his Combat Report bio - mentions 18,000 feet a lot, that being in the SE5a, but he does tend to report that the Fokker DVIIs were higher up a lot of the time. Most dogfights of course ended up lower down as the lift from the wings was expended on turns.
The very famous dogfight between
Lanoe Hawker in his DH2 and
Manfred Von Richthofen in his Albatros DII reportedly lasted over half an hour and lost a lot of height in that time. The DH2s of Hawker's flight were on a normal line patrol with Hawker letting a subordinate lead the patrol (Captain J Andrews), so he could gain experience. Typical altitude for the DH2 on patrol was about 10,000 feet, and the Albatros flight which MVR was part of was a little lower, with the DH2s being lured over the German lines before they were able to dive on the DIIs. The fight between Hawker and Richthofen ended up pretty much at treetop height as Hawker made a break for home, but he apparently looped a few times to throw Richthofen off before making a break for it, so that would tend to suggest him being at probably no lower than 500 feet when pulling that sort of stuff. It's a matter of conjecture whether that was a smart thing to try, although we know that ultimately it didn't work since Hawker died, and Richthofen tended to scoff about such aerial antics, claiming they were of no use in air fighting. But whatever the truth of things, it is certainly a good example of how much height goes out of the window in a turning fight.
Lots of pilots report late war German two-seaters being at between 18,000 and 22,000 feet, with the crews sometimes using oxygen systems, and in fact Bill Lambert mentions one of the first times he, or anyone else in his Squadron, had seen one of these leaving a contrail in the sky, which on an average day tends to start happening at 20,000 feet and above. The fact that people came out of their huts to observe it means it cannot have been that common a sight.
Victor Yeates - in his semi autobiographical Winged Victory novel - often mentions that Sopwith Camels would operate in the middle altitudes with stuff like the SE5a operating above it, which is broadly similar to what appears to have happened with the Dr1, with the Albatros, Pfalz and such flying above that.
Beyond the engine performance issues and the tactical advantage of height, there is also the meteorological aspect of things beyond cloud cover. The prevailing winds on the western front tended to favour the Germans, and obviously as you get higher, the wind tends to speed up, so it would certainly make sense for bombers and balloon busters on the British/French/US side to climb up high over their airfields and then set off to the target with wind assistance, possibly returning in a shallow dive to penetrate the headwind on the way home as well as gradually making a better groundspeed as they got lower down.
In the warmer climates of the middle eastern fronts, obviously things would tend to be at lower altitudes generally, since there'd be a little bit less lift in those temperatures and less power to the engines, but even so, it was probably not hugely different from in the west.
Al