Optoisolator with Logic Output - How To Use IC Circuit Example?
Both devices have the same type of output, and must be used in the same way.

Both need a decoupling capacitor between VCC and ground (both datasheets say so).

Both have an open-collector output (which can only pull the output down), so they need a pull-up resistor between the output line and VCC.
The value of the pull-up resistor depends on the required speed; the datasheets have no switching speed/load resistor graphs, so you have to measure. (You get the speed specified in the datasheet with the specified load resistor; larger resistors result in slower switching, but less power usage.)

Do not use a capacitor on the output signal line.
The datasheets show test circuits, which have a capacitor there to simulate stray capacitances in a real circuit. Adding a real capacitor to your circuit would reduce the signal quality.