I have universal analytics configured and send events using the gtag function but how can I also add in GA4? Is there a different function for GA4? If I call, the same gtag functions will it cause conflicts?
The documentation says to just add a new gtag config, but it doesn't say anything about referencing the events. Do I just duplicate the events and send them in different formats? If so, won't that count as duplicated events in both platforms?
https://developers.google.com/analytics/devguides/collection/ga4/basic-tag?technology=gtagjs
How can this be done cleanly with only sending events to each platform separately?
I am using this for UA. What is the GA4 version aside from syntax of the object being different?
window.gtag("event", "view_item", {
items: [
{
id: productID,
name: product.title,
category: product.productType,
price: product.priceRange.minVariantPrice.amount
}
]
})