events.js
export function sendEventViewItem(item, location = {}) {
const { type = 'click' } = item;
const { pathname } = location;
const value = {
pathname,
type,
...item
};
gtag('event', 'view_item', {
items: [value]
});
}