This is pretty confusing to me, even after reading through Audacity and PulseAudio's Wiki and Docs.
I know this may be a pretty detailed and long explanation, so thank you in advance for any advice you can give.
Open gnome-volume control, and choose line-in from the input tab.
NB: While the screenshot is outdated, in the latest versions of Ubuntu this has been tested and works. However, results may vary depending on the sound card. If you encounter issues, please ask a new question, linking to this question for context.
Then in audacity ensure that it is set to record from Pulse. This will ensure that it records whatever pulseaudio is recording.