Why are you using a custom integration to do this when statistics integration is built in and arguably better?