// src/GTMManager.js
import TagManager from 'react-gtm-module';
import {gt} from "react-big-calendar/lib/utils/dates";

const GTM_ID = 'G-B8DCT6M79Y'; // 替换为您的GTM ID
const GA4_ID = '8516447499'; // 替换为您的GA4 ID

export const gg_setTagID=(GTM_ID="G-B8DCT6M79Y",GA4_ID="8516447499")=>{
    // Initialize GTM
    TagManager.initialize({ gtmId: GTM_ID });

    // Initialize GA4
    window.dataLayer = window.dataLayer || [];
   function gtag(){
        window.dataLayer.push(arguments);
    }
    gtag('js', new Date());
    gtag('config', GTM_ID);
    gtag('config', GA4_ID);
    window.gtag=gtag;
};

export const gtrack=(eventName,params)=>{
    // gtag('event','d0',{currency:'BRL',value:data.golds,transaction_id:data.order_sn})
    window.gtag('event',eventName,params)

}
