I live in a rural area in the UK so even though I am lucky enough to have OpenReach FTTP (Fibre to the Premises) I usually have a number of outages each year due to OpenReach doing work or physical damage happening to the cables strung along the power poles (usually due to trees). I also have a UniFi home network setup with a UniFi Security Gateway, which natively supports having two WAN connections, so I finally decided to setup a secondary 4G/LTE connection to have failover for when I lose my main connection.
I originally tried this with a D-Link 4G router, however that didn’t reliably connect to the 4G, so I ended up going with a TP-Link TL-MR6400 4G Wi-Fi Router with a GiffGaff SIM. I chose GiffGaff because I have reasonable O2 Network signal in my area, and this would allow me to have a month to month data arrangement that I can ramp up and down as needed. In my case I usually have this on a £10/month package in order to have 20Gb of data available, which should get me through a rainy day of the kids watching iPads if needed.
The Unifi Security Gateway I’m using has three interfaces - I am using WAN1 as my primary Internet connection, LAN1
as the port for my internal network, and I’ve enabled WAN2/LAN2 as my secondary WAN port in “Failover only” mode as follows:

Once this is done, you should be able to check to see this is all working if you SSH into your UniFi Security Gateway as follows:
admin@Gateway:~$ show load-balance watchdog
Group wan_failover
  eth0
  status: Running
  pings: 14941
  fails: 0
  run fails: 0/3
  route drops: 0
  ping gateway: ping.ubnt.com - REACHABLE
  eth2
  status: Running
  failover-only mode
  pings: 14869
  fails: 228
  run fails: 0/3
  route drops: 0
  ping gateway: ping.ubnt.com - REACHABLE
And also be able to see interface flow stats:
admin@Gateway:~$ show load-balance status
Group wan_failover
  interface   : eth0
  carrier     : up
  status      : active
  gateway     : X.X.X.X
  route table : 201
  weight      : 100%
  flows
      WAN Out : 1236000
      WAN In  : 1465
    Local Out : 826
  interface   : eth2
  carrier     : up
  status      : failover
  gateway     : X.X.X.X
  route table : 202
  weight      : 0%
  flows
      WAN Out : 0
      WAN In  : 0
    Local Out : 0
Note that if you have two full time Internet connections, it will also fail over correctly in the event that one of those connections goes down. I haven’t chosen to do that because my primary connection is much faster than the backup, and I choose to only have it online for when the faster one goes down.