Decided to use Google's recommended new method of installing Google Analytics: "gtag.js"
I've followed the instructions for measuring "Enhanced Ecommerce" and as part of that build, here's my code to measure a product click:
gtag('event', 'select_content', {
"content_type": "product",
"items": [
{
"id": "TEST-SKU-1",
"name": "Test Product",
"list_name": "Home Page",
"category": "For Testing",
"list_position": 1,
"price": 8.76
}
]
});
I then added that code on the link to the product like this:
<a href="/for-testing/test-product-1" onclick="gtag('event', 'select_content', { 'content_type': 'product', 'items': [{ 'id': 'TEST-SKU-1', 'name': 'Test Product', 'list_name': 'Home Page', 'category': 'For Testing', 'list_position': 1, 'price': 8.76 }] });">
It shows up inside Google Analytics Events (it works), but it shows up with an Event Category/Action/Label of "engagement"/"select_content"/"product". After doing some research, it looks like Google is auto-magically building the Event for me, based off of some new "standard way" they want to do things :-(
QUESTION: How do I override the gtag.js defaults for Event Category/Action/Label it uses when I send a "Product Click"?
NOTE: I realize that I can swap out gtag.js for analytics.js or I could use jQuery's post() method and send this directly via Google Analytics' Measurement Protocol but that is NOT my question... I need to figure out "the new correct non-hacky way of doing this"... preferably.