Ecommerce Items to String or Sum Item Values – GTM Template (Server)

Ecommerce Items to String or Sum Item Values is a Google Tag Manager Server-Side Variable Template (SGTM).

This Variable turns the Ecommerce Item array (e.g. [{item_id: ’12’, quantity: 1},{item_id: ’34’, quantity: 2}]) into a string (e.g. ’12|34′), or sums Item Values (e.g 3). When summing values you can choose to multiply the value with quantity (e.g. [{price: 10, quantity: 1},{price: 20, quantity: 2}]) which will give the result 50).

The Template is available in the Google Tag Manager Template Gallery.

Variable Functionality Overview

  • Select Mapping Method
    • GA4 Standard Ecommerce Events
    • Custom Mapping
  • Select Item Parameter Type & Action
    • Create String from Item Parameter
      • Standard Item Parameters
      • Custom Item Parameters
      • Choose Delimiter
      • Return Unique Items
    • Sum Values from Item Parameter
      • Standard Item Parameters
      • Custom Item Parameters
      • Multiply Item Value with Item Quantity

Full documentation of the Template can be found on Github.

Related Information

A similiar Variable for Google Tag Manager (Web) does also exist:

Possible use cases

  • Use the Variable to create Ecommerce value by multiplying price with quantity (if this is missing in the implementation)
  • If you need to track data both on Item Scope and Event Scope, use this Variable to create Event Scoped data.
  • Send Items data as a string to ex. Floodlight for marketing purposes.

Image of the Template

Ecommerce Items to String or Sum Item Values - GTM Template (Server)

Comments are closed.