Google Tag Manager Enhanced Ecommerce Object Builder Template – News Couple

Google Tag Manager Enhanced Ecommerce Object Builder Template

One of the great things about Google Tag Manager-optimized e-commerce deployments is that you can use a custom JavaScript variable to generate the necessary data.

There are many reasons for doing this, the main one being the flexibility it provides for file processing dataLayer In the event that you need to make quick changes to the site, and it will take a long time to wait for a new version of the JavaScript site.

However, there is also the possibility that you may not have access to a file dataLayer Enhanced e-commerce implementation Absolutely. This is not a very interesting situation, as you will have to rely on things like scraping the DOM to populate the necessary values.

To help with some manipulation pain ecommerce object in dataLayer And To build a fully optimized e-commerce app from scratch without dataLayer, I’d like to make a new custom form of my own: Enhanced Ecommerce Object Builder Variable template.


Simmer . Newsletter

Subscribe to the Simmer newsletter to get the latest news and content from Simo Ahava right in your inbox!


The template allows you to create an optimized e-commerce object from scratch. You can of course use Google Tag Manager variables to populate parts of a file ecommerce object of dataLayer In the template itself (see in the screenshot above how the file Currency symbol The field is populated with a variable).

Any variable created with this template will then return to a valid syntax ecommerce object as its return value, which means you will need to get a tag with the extension Enable Enhanced E-Commerce Features The setting is toggle, and the respective variable selected from the list:

Enhanced Ecommerce Settings

Now, when you fire this tag, it will pull a file ecommerce An object generated by the variable (and form code), and as a result populate the result to GA with the correct optimized ecommerce parameters.

Enhanced e-commerce parameters

Download and import the form

To download the template, save the following file with the extension .tpl The extension is somewhere on your computer:

Optimized for E-Commerce Objects Builder.tpl

Next, use the instructions here to import the template into your container.

Form import menu

How to use the form

First, you need to create a file User-defined variable using the form. So head to Variables, click new, and choose File Enhanced Ecommerce Object Builder When prompted for the type of variable.

new variable

The important thing to note is that All text fields on the form accept Google Tag Manager variants. So if you want to fill in some fields dynamically, you can.

Enhanced Ecommerce Data Type

The first check you need to make is Type. The options are:

  • promotion offer

  • Click Promote

  • impression show

  • impression click

  • View product details

  • add to cart

  • Remove from cart

  • paying off

  • exit option

  • Purchase

  • Recovery

If these choices seem strange or unfamiliar, I encourage you to read about them in my Enhanced Ecommerce Guide.

If you choose promotion offerAnd Click Promote, or impression show, The work data And Product data Groups will disappear, because these three enhanced e-commerce data types do not support sending action and product data.

Currency symbol

If you want to set a local currency to hit, you can set it by toggling a file Set currency symbol Check the box and write the currency symbol in the field that appears.

work data

work data Available only if you select Enhanced Ecommerce Action as the tag type. This excludes PromotionsAnd Promotion clicks And impression views, which has its own settings in the form.

Under work data, you will see some options, depending on the type you selected.

if you choose paying off or exit option, you will see the fields for the exit and option step:

Exit options

if you choose Purchase or Recovery, you will see the fields for the transaction:

Purchase and redemption fields

Regardless of the action you selected, you will always see the field where you can add the list of products:

Product Actions List

Product data

Product data Available only if you select Enhanced Ecommerce Action as the tag type. This excludes PromotionsAnd Promotion clicks And impression views, which has its own settings in the form.

The product data set is divided into three options. First, you have the products themselves. Second, you can add custom dimensions across the product. Finally, you can optionally add custom product scope metrics.

products They are added by clicking add product button. This opens an overlay where you can configure individual product settings.

dialog box

You can add as many products as you like, bearing in mind that there is a limit of 8192 bytes for the Google Analytics results payload size.

Also note that not all fields are necessary for all types of actions.

Product-wide custom dimensions They are added by enabling product-wide custom dimensions by selecting the relevant checkbox, then inserting new rows into the table that appears.

Product-wide custom dimensions

Add a custom dimension index number to a file index and the component value assigned to Values vertical.

In the Apply to SKUs , you are adding the product IDs/SKUs to which the custom component should apply. If you want to apply the dimension to all fields in the result, leave Apply to SKUs Empty field.

As you can see from the screenshot above, you can add multiple rows with the same index as long as a file Apply to SKUs The field does not overlap. Otherwise, only the last value of any given index is sent to Google Analytics.

Also note that you can add more than one SKU to the field. You can do this by separating the values ​​with a comma: shirts123,shirts1234.

Yes, this is a rather complicated way to add custom dimensions to products, but unfortunately there is no way to get a table of dynamic size (or of any type) as one of the fields in Add products table.

The same process described above applies to Product-wide custom metrics, very.

Product-wide custom metrics

Displayed impressions

You can add files impressions To any optimized e-commerce outcome, regardless of the outcome type.

Displayed impressions

Adding impression views and any custom dimensions and/or metrics related to the product scope that are associated with it follows the exact same process as those for regular products, so check the previous chapter for a refresher. The main difference is that list It is one of the fields that you need to add to the impressions data, so that the impressions can be customized for a specific product listing.

Promotions seen

You can add files Promotions To any optimized e-commerce outcome, regardless of Click Promote.

Show promotions

Promotions are added simply by clicking add promotion button, then enter values IDAnd NounAnd creative, And Location.

Clicked on promotions

You can add files Promotion clicks If you have chosen Click Promote as a kind of work.

Clicked upgrades are added exactly the same way you add displayed upgrades, so see the previous chapter for reference.

test everything

Once you’ve created the variable and added it to a tag (see the chapter titled Purpose for a refresher on how to do this), you’ll need to test it works.

The easiest way to test is with a browser extension like GTM/GA Debug or dataLayer Inspector+. If everything worked, you should see all the data added to the result generated by the tag whose ecommerce settings you’ve modified.

GTM / GA Debugging Plugin


With this changing paradigm, you should be able to create custom optimized ecommerce settings without taking advantage of a complete and synthetically valid formula. dataLayer Theme. Of course, access to dataLayer Optimized ecommerce data formatting is almost always more reliable than building payloads from scratch like this, but I think there are use cases for a custom setup as well.

Also, since you can add other GTM variables to almost all fields of this form, you can use Enhanced Ecommerce Object Builder To coordinate and process data that already exists dataLayer.

Let me know in the comments if you think there are features that are missing. One of the things I would like to work on at some point is letting you submit a file ecommerce object of dataLayer as the basis for the variable, but then override the individual fields and values ​​of that object with this template.

Source link

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button