What you seem to need is a many-to-many relationship between all three of your tables. I presume you're using mysql for you database, so you will want to make cross-reference tables 'in between' your current tables.
A simple diagram:
user -> user_product <- product
user -> user_event <- event
product -> product <- event
The outside tables have a one-to-many relationship with the middle tables, which you will reference with a foreign-key. This way you can simply count the rows in the crossref tables to get your totals. I hope this makes sense. Personally, I use Propel ORM (object relational mapping) with my CI installations for all my database needs. There are other ORMs that may handle this type of relationship better, but Porpel is the easiest to get working, in my opinion.
Feel free to ask for more clarification.