# Track this add to cart click

**URL:** <https://community.piwik.pro/t/track-this-add-to-cart-click/5088>\
**Category:** Data collection and tags\
**Created:** [April 22, 2025, 12:46pm UTC](https://community.piwik.pro/t/track-this-add-to-cart-click/5088 "2025-04-22T12:46:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dave](https://avatars.discourse-cdn.com/v4/letter/d/ee7513/32.png) [@dave](https://community.piwik.pro/u/dave)\
**Post date:** [April 22, 2025, 12:46pm UTC](https://community.piwik.pro/t/track-this-add-to-cart-click/5088/1 "2025-04-22T12:46:57Z")

</div>

Trying to track this button click (add to cart)

\< button type=“submit” title=“Order” class=“action primary tocart” id=“product-addtocart-button”\>Order

with this trigger

 ![1](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/2/2aef92693e54a14d5939923134198b054fec2e99.jpeg)

But i must be doing something wrong since it’s not working (switching to click id is not moving the needle as well).

Thxs

---

<div class="post-metadata">

**Author:** ![jfidala](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/jfidala/32/4263_2.png) [@jfidala](https://community.piwik.pro/u/jfidala)\
**Post date:** [April 22, 2025, 1:07pm UTC](https://community.piwik.pro/t/track-this-add-to-cart-click/5088/2 "2025-04-22T13:07:19Z")

</div>

Hello @dave

`Click element` would be used for object. In this case I can suggest you to use  
`Click ID` or `Click Classes` instead and match it with parameters from your button.

example:  
`Click ID` - `matches` - `product-addtocart-button`

If you aren’t sure what variables are visible for object you are clicking, there is also another method. You can always open debug mode → connect to tested website → go to “Events” instead of tags → select from list action you just did → check variables visible by tag manager

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/8/85eb3c7e9e467245eac8b874818ca98f2d72d777.png)

---

<div class="post-metadata">

**Author:** ![dave](https://avatars.discourse-cdn.com/v4/letter/d/ee7513/32.png) [@dave](https://community.piwik.pro/u/dave)\
**Post date:** [April 22, 2025, 1:33pm UTC](https://community.piwik.pro/t/track-this-add-to-cart-click/5088/3 "2025-04-22T13:33:33Z")

</div>

Thxs @jfidala for the fast reply. When checking events there is no click id visable:

 ![1](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/6/63de9c5ee1cbe00baeb2736744fcee2dc9088b39.jpeg)

---

<div class="post-metadata">

**Author:** ![jfidala](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/jfidala/32/4263_2.png) [@jfidala](https://community.piwik.pro/u/jfidala)\
**Post date:** [April 22, 2025, 1:57pm UTC](https://community.piwik.pro/t/track-this-add-to-cart-click/5088/4 "2025-04-22T13:57:58Z")

</div>

Class is changing when element is clicked and I think it’s gone for brief second - but I’ve noticed in console that there is `stg.formSubmit` with each Add to cart button pressed.

Maybe you can do Form submission trigger instead and set `Form URL` to `starts with` → `"https://www.matthys.net/en/checkout/cart/add/` ?

---

<div class="post-metadata">

**Author:** ![dave](https://avatars.discourse-cdn.com/v4/letter/d/ee7513/32.png) [@dave](https://community.piwik.pro/u/dave)\
**Post date:** [July 1, 2025, 12:31pm UTC](https://community.piwik.pro/t/track-this-add-to-cart-click/5088/5 "2025-07-01T12:31:01Z")

</div>

Something similar @jfidala .

Having this click class and using that in the trigger but the tag is not firing 😕

![4](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/optimized/2X/c/c94d5ad9446b869ab4146338447514774c45b266_2_690x55.jpeg)

 ![2](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/7/70a3762203aeb30053f937d0bc6e535b6c11dee8.jpeg)

So not sure what’s going wrong? Thxs!

---

<div class="post-metadata">

**Author:** ![joao](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/joao/32/1820_2.png) [@joao](https://community.piwik.pro/u/joao)\
**Post date:** [July 1, 2025, 2:41pm UTC](https://community.piwik.pro/t/track-this-add-to-cart-click/5088/6 "2025-07-01T14:41:05Z")

</div>

Did you try using this CSS selector?

**Click Element** matches  
`#product-addtocart-button, #product-addtocart-button *`

When you want to measure clicks on non-link (`<a>`) elements, you may want to explicitly target children elements as well (using \*), otherwise depending on where you click within the button the trigger may not fire.

If it’s a link element you can try to activate the option to “Wait for tags before loading the next page”, sometimes the trigger does not fire unless you activate this option.

---

<div class="post-metadata">

**Author:** ![dave](https://avatars.discourse-cdn.com/v4/letter/d/ee7513/32.png) [@dave](https://community.piwik.pro/u/dave)\
**Post date:** [July 3, 2025, 1:55pm UTC](https://community.piwik.pro/t/track-this-add-to-cart-click/5088/7 "2025-07-03T13:55:43Z")

</div>

> [@joao](#):
>
> the option to “Wait for tags before loading th

That was the solution 🙂 Thxs
