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

Please add method for Content Tracking #21

Open
denverFAN opened this issue Sep 29, 2023 · 10 comments
Open

Please add method for Content Tracking #21

denverFAN opened this issue Sep 29, 2023 · 10 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@denverFAN
Copy link

denverFAN commented Sep 29, 2023

Hi @donni106

Your package is already awesome, works great. Thank you very much for developing it.
It would be nice if there is a method trackContent() to track content as it is described in Matomo documentation. Many teams incl. us who installs Matomo usually use this Content Tracking feature.

Below is a brief description of the required parameters to be passed in the HTTP API request for Content Tracking.

Optional Content Tracking info

c_n — The name of the content. For instance 'Ad Foo Bar'
c_p — The actual content piece. For instance the path to an image, video, audio, any text
c_t — The target of the content. For instance the URL of a landing page
c_i — The name of the interaction with the content. For instance a 'click'

To track a content impression set c_n and optionally c_p and c_t. To track a content interaction set c_i and c_n and optionally c_p and c_t. To map an interaction to an impression make sure to set the same value for c_n and c_p. It is recommended to set a value for c_p.
@denverFAN denverFAN added the enhancement New feature or request label Sep 29, 2023
@donni106
Copy link
Owner

donni106 commented Sep 29, 2023

Hi @denverFAN and thank you very much.

I understand your wish. Please look into #19 (comment) where I described something similar. You should be able right now to put your additional tracking params from https://developer.matomo.org/api-reference/tracking-api#optional-content-trackinghttpsmatomoorgdocscontent-tracking-info into userInfo.

In the optional userInfo param you can set any value from the API docs. So the following example should work.

trackAction({ name: 'Foo', userInfo: { c_n: 'Bar', c_p: ... } })

Please give it a try and tell us your experiences.

I can look forward to make this more clear in the documentation and will see if I can change the param name to something more generic or add multiple ones for the optional params.

@denverFAN
Copy link
Author

Hi @donni106

Thank you for the quick reply and suggested solution.

Yes, I understand that, but still this is kind of a workaround. For future, it would be better if there is a separate method listed in the documentation. This will help other people incl. newbies to quickly find what they need instead of searching for a solution in Issues section. As I mentioned earlier, based on our experience this Content Tracking feature is very much frequently used. For sure this will make a package better.

Have a nice day!

@donni106
Copy link
Owner

Thank you for the helpful exchange. I can understand that very well. I will make it a point to provide different methods to ensure more clarity in use.

@angelxmoreno
Copy link
Contributor

I am unable to do this with the current TypeScript definitions because the userInfo type for the trackAction method only recognizes uid as a valid userInfo param. I started a discussion on DefinitelyTyped and the module owner, @zecergin has been pinged.

However, I really think helper methods that match each of the matomo tracking types would be absolutely amazing. I am willing to add PRs if you also see value in this @donni106 . If, in contrast, you feel like this lib should remain low-level, then perhaps an auxiliary repo that wraps this repo would be a better option.

What do you think?

@donni106
Copy link
Owner

Thanks for asking, I agree with having multiple clear helper methods to make it easier to use and get started.
I would love to see some contributions to share time and effort.

@angelxmoreno
Copy link
Contributor

I came across this page on the Matomo FAQs: https://matomo.org/faq/general/what-features-of-matomo-analytics-are-supported-when-tracking-mobile-app-analytics-using-android-or-ios-sdk/

Content Tracking (content impressions and content interactions) is not yet supported in SDKs

That being said, should we even consider adding it? I can make a PR if so.

@donni106
Copy link
Owner

I see good reasons to be able to track content impressions and content interactions. I even found it documented in the iOS SDK: https://github.com/matomo-org/matomo-sdk-ios#content-tracking
The info on the other page seems outdated.

@angelxmoreno
Copy link
Contributor

@donni106 how do you feel about Typescript and how do you feel about converting the tracker into TS? There are a few features I'd love to make a PRs for but I wouldn't be able to use those features in my project. This is because the typed-definitions donated at DefinitelyTyped would be outdated.

@donni106
Copy link
Owner

donni106 commented Jan 2, 2024

As we have a few mentions now regarding disadvantages according to not have TS, we should aim for converting the code base. It should be a manageable effort overall. @73k05 would you be available for helping out here, as it would serve for #20?

@73k05
Copy link
Contributor

73k05 commented Jan 9, 2024

Hey @donni106 moving to TS is always a good idea 🎄 I'm down to review the PR or help in a specific task, let me know how I can help 🙂

@donni106 donni106 added the help wanted Extra attention is needed label Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants