Example of integration of Matomo with OneTrust?


I’m trying to integrate Matomo into a single-page application website built in React. I’ve integrated the basic Matomo code snippets into my app and they seem to work, but when I integrate my cookie consent manager code, OneTrust, I don’t understand how to make them mesh together. Does anyone have an example of this integration that they can share? I’ve already read the docs here:

Currently I have the following in my Matomo cookie for consent:

[boilerplate Matomo code ] _paq.push(['requireConsent']); _paq.push(['trackPageView']); _paq.push(['setConsentGiven']); [more boilerplate Matomo code ] I think I need an event handler to handle the setConsentGiven element, but I'm not sure how to integrate it with OneTrust. Examples or suggestions would be greatly appreciated. Thanks!