I switched from Android to Lineage OS, and I installed the most basic Gapps package possible, called 'pico', to get the bare minimum requirement for the Google Play store. I then manually disabled Google Play services. If I want to get to the Play store, I have to manually re-enable this.
Recently, I was in the car with my wife and son, and I mentioned that I miss the funny vines that were produced when vine.co was still active. Then, when I got home, I connected to wi-fi, went to Youtube.com through a mobile browser (I don't have the app installed), and the homepage was showing my 'funny vine compilations'. I was not searching for vines before this.
Then, today, I was telling my wife that we need a better vaccum cleaner, and that we should order a Dyson on Amazon. An hour later, I went to Amazon.com on my phone and the home page showed a deal on Dyson vaccum cleaners.
The reason I went through the trouble of putting a custom ROM on my phone was that I didn't want my phone listening to me. I'm not logged into my Youtube or Amazon accounts on my phone, and I didn't search for these things. I suppose it could be a coincidence, but I highly doubt it.
So my questions are: how is my phone spying on me? And how can I prevent this?