This project is an example usage for sending event to google analytic from ByteArk Player React.
- ByteArk Player React v1.0.0-beta14^
- Google Analytics Measurement ID
- Add
gtag
script tag inside<head>
tag
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script>
- Add gtag configuration to your page setup function e.g.
useEffect
window.dataLayer = window.dataLayer || [];
function gtag(){window.dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'GA_MEASUREMENT_ID');
window.gtag = gtag;
Send event to Google Analytic
window.gtag('event', 'ACTION', { metadata });