Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site search track custom data #96

Open
p-aron opened this issue Oct 18, 2024 · 1 comment
Open

Site search track custom data #96

p-aron opened this issue Oct 18, 2024 · 1 comment

Comments

@p-aron
Copy link
Contributor

p-aron commented Oct 18, 2024

In matomo you can pass customData to siteSearch:
https://github.com/matomo-org/matomo/blob/4061709f5ff7f11b9c74bb09168865a0950d387d/js/piwik.js#L7015

In the library MatomoTracker accepts 3 parameter:
trackSiteSearch(keyword: string, category?: string, resultsCount?: number): void {
this.delegate.push(['trackSiteSearch', keyword, category, resultsCount]);
}

I have different filter options for querying some data. I would like to pass the filter options as custom data.

My question is that would it make sense to add customData to the trackSiteSearch method?
Or setting the custom variables on the matomoTracker (this.matomoTracker.setCustomVariable) would do the same thing?

@EmmanuelRoux
Copy link
Owner

Hi @p-aron

You're right, that's an undocumented feature (see docs here).

But as the api actually exists, it could be added to trackSiteSearch, along with other similar methods. We could also add setCustomData method.
(PR welcomed! 🙂)

Note: I think that custom data is just an alias to a custom variable named "data". So maybe setCustomVariable could suit your needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants