Search code examples
google-tag-manager

Google Tag Manager custom event (product page views) not firing tags


I tried to set up a tag that should be firing when a customer goes on the product page.

I found out in the dataLayer that there is this object: pageType: 'product'

After that I used this object in my trigger as so:

Picture of trigger

In the tag itself, I made sure that enhanced ecommerce was enabled, and also checked the checkbox that dataLayer is being used, however it is still not firing.


Solution

  • The first thing you need is to create a custom variable to capture the information stored in the dataLayer.

    In the main menu, click variables: GTM variables menu

    Click on the button "New" in the User Defined Variables section. Name the variable DLV - pageType, select Variable Type Data Layer Variable name it pageType and hit Save when you are done: User Defined dataLayer variable

    Next, click on Triggers in the main menu to add a new trigger. Name the trigger, select Page View as trigger type, Only Some Page Views and make sure it only fires when DLV - productType equals product: enter image description here

    Now the only thing that is left is to configure the tag to the trigger.