Why, that's simple! Copy this script to your USG, run chmod +x on it and then, as a user with sudo permission, execute it.
Shamelessly borrowed from Brittanic on the Ubiquiti Unifi forums
Simply run the following command (note, if you are at all security concious-don't run it and instead review the script, then copy it to your USG to execute).
curl https://gist.githubusercontent.com/troyfontaine/7e6f93e32621177fc9a94e823adc52b5/raw/fix_ddns.sh | sudo bash