matomo-org / tag-manager

Free Open Source Matomo Tag Manager - A simple way to manage and maintain all of your (third-party) tags on your website.
https://matomo.org
GNU General Public License v3.0
176 stars 58 forks source link

Support trackSiteSearch with mtm.push #569

Open Chardonneaur opened 2 years ago

Chardonneaur commented 2 years ago

Hello, it is currently not possible to support the trackSiteSearch with mtm.push. Is there any development planned about it?

Best regards,

sgiehl commented 2 years ago

@Chardonneaur Is this a tagmanager related request?

Chardonneaur commented 2 years ago

@sgiehl maybe it is more a documentation question. In fact, the differences between paq.push and mtm.push is not clear. Is mtm.push only tag manager related or can it be used with any other methods and will substitute all paq.push methods? My clients are saying that mtm.push work for most cases but not for the track site search.

sgiehl commented 2 years ago

I'd say mtm is only tag manager. I'll move the issue there, maybe someone with more tagmanager know how can answer that.

snake14 commented 2 years ago

I wonder if this could potentially be related to an issue where _paq.push doesn't always work right with MTM. I don't think that trackSiteSearch will work with _mtm.push, but it should work with _paq.push while using our tag manager. If it doesn't, it would be related to that existing issue. Anything to add @AltamashShaikh ?

AltamashShaikh commented 2 years ago

@snake14 You are correct, we might need to create an additional tag/option in the existing code to support it or _paq.push(['trackSiteSearch'keyword, category, searchCount]) can be executed as a custom HTML tag with a combination of Custom Variable having the other required params.

tomper00 commented 2 years ago

I might have time look into a pull request for this next week. My suggestion is to add trackSiteSearch as an option in the Matomo Tag as mentioned here: https://github.com/matomo-org/tag-manager/issues/570

Regarding the implementation the documentation for search suggests you do not track page views when you track search. I can see the point from an analytics perspective, but are there any other things to think about there from a more technical perspective?

AltamashShaikh commented 2 years ago

cc @mattab for your view on this

tomper00 commented 2 years ago

I just added some code that adds search tracking to the Matomo Tag https://github.com/matomo-org/tag-manager/pull/575 @mattab

Chardonneaur commented 2 years ago

@tomper00 honestly, if you make it pass, for sure, I would like to interview you for my book dealing with this part.

tomper00 commented 2 years ago

@Chardonneaur it definitely needs some documentation, since everything is kind of connected :)

Chardonneaur commented 2 years ago

@tomper00 I would be very interested into. In fact, so far, contributing thanks to translation, I get it, contributing thanks to developing, I get it. But now, how to contribute by coding to an existing plugin... question mark for me.