In the "analytics.js" version of Google's Enhanced E-commerce, impression data is passed to Google Analytics using the ec:addImpression command. This was changed in the updated "gtag.js" version. When using the GTAG version of the tag, the "add_to_cart", "remove_from_cart" , "select_content", "view_item" or "view_item_list" events must be triggered in order to pass the product data for an impression. These events are passed to Google through the tag's mappings.
When tracking product impressions, data quality can be improved by limiting the size of the requests sent to Google. The maximum payload length allowed by Google is 8192 bytes, which is easily surpassed if a large number of impressions are sent in a single request (ex: 50 - 60 products). Optimal results can be achieved by sending smaller data sets with each request (ex: 8 - 10 products), which is sufficient for data collection as the products impressed upon a visitor are usually the items above the fold of the webpage.
1. Trigger the Event
Set a 'view_item_list' event in the mappings. In this example, the event will trigger when the page name equals category.
2. Map Required (and optional) Variables
Per Google's requirements, "impression_id" and "impression_name" are required for this event and will also need to be mapped. These variables should be an array of strings. Other parameters can be passed with this event. The example from Google below shows which parameters can be sent and an example of the value for each variable.