Security News
NIST Misses 2024 Deadline to Clear NVD Backlog
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
@logicwind/react-native-matomo-tracker
Advanced tools
@logicwind/react-native-matomo-tracker is a React Native library that provides integration with the Matomo analytics platform for tracking user interactions and events in mobile applications and TV applications. This package supported Android, ios, Android TV, Apple TV, Fire TV.
With @logicwind/react-native-matomo-tracker, developers can seamlessly integrate Matomo analytics into their React Native applications, allowing them to track various user interactions such as screen views, button clicks, form submissions, and custom events. This integration enables developers to gain insights into how users interact with their mobile apps, monitor app performance, and make data-driven decisions to improve the user experience.
Using npm:
npm install @logicwind/react-native-matomo-tracker
or using yarn:
yarn add @logicwind/react-native-matomo-tracker
Then follow the instructions for your platform to link @logicwind/react-native-matomo-tracker into your project:
React Native 0.70 and above
Run npx pod-install
. Linking is not required in React Native 0.70 and above.
Run npx pod-install
. Linking is not required in React Native 0.70 and above.
import {
createTracker,
setUserId,
setVisitorId,
trackDispatch,
trackDownload,
trackEvent,
trackImpression,
trackInteraction,
trackScreen,
trackSearch,
disableTracking,
enableTracking,
startSession,
trackMediaEvent
} from '@logicwind/react-native-matomo-tracker';
The createTracker function is used to instantiate a tracker object for Matomo analytics within a React Native application .It requires the parameters matomo-url
and siteId
, with the optional parameter auth_token
.
for matomo-url madatory to add /matomo.php
end of url.
createTracker("https://your-matomo-url/matomo.php","siteId")
createTracker("https://your-matomo-url/matomo.php","siteId","auth_token")
The MatomoTracker starts a new session whenever the application starts. If you want to start a new session manually, you can use the startSession() function.
startSession()
The trackScreen method is used to track screen views within a React Native application. It will take screen name
and title
parameter.
trackScreen("HomeScreen","Navigate to home screen")
The trackEvent method is used to track custom events within a React Native application. It will take category
,action
,name
and value
parameter.
trackEvent("test category","test action"," test name",2);
trackEvent("basket",JSON.stringify({
id: 3745092,
item: 'mens grey t-shirt',
description: ['round neck', 'long sleeved'],
size: 'L',
}));
The trackOutlink method is used to track clicks on outbound links within a React Native application. It will take only url
parameter.
trackOutlink("https://www.google.com/")
The trackSearch method is used to track search keyword within a React Native application. It will take only keyword
parameter.
trackImpression("Logicwind")
The trackImpression method is used to track specific content or elements within a React Native application. It will take only contentName
parameter.
trackImpression("Test Track Impression")
The trackInteraction method is used to track users engage with specific elements or perform actions within a React Native application. It will take contentName
and contentInteraction
parameter.
trackInteraction("Test Track interaction","test inetraction")
The trackDownload method is used to track the download of files or resources within a React Native application. It will take category
,action
and download-url
parameter.
trackDownload("Download","PDF Download","https://example.com/download.pdf")
The setUserId function is used to assign a unique identifier to a user in a React Native application. It will take id
parameter.
setUserId("test@gmail.com")
By default matomo generate the unique visitor id but if you want custom vistor id then setVisitorId function allows you to manually set a custom visitor ID for tracking purposes within a React Native application . It will take visitor-id
parameter. It must be a 16 character long hex string
setVisitorId("2c534f55fba6cf6e")
The MatomoTracker will dispatch events every 30 seconds automatically. If you want to dispatch events manually, you can use the trackDispatch() function.
trackDispatch()
By default the tracking is enable. If you want to disable traking, you can use the disableTracking() function.
disableTracking()
The enableTracking function is used for enable traking.
enableTracking()
To enable logging for debugging purposes in the Matomo Android SDK and IOS SDK, you can set a custom logger. This is useful to see detailed logs of the SDK’s operations, which can help during development and troubleshooting.
setLogger()
trackMediaEvent function use to monitor user interactions with media content, such as audio or video files. It allows you to track various events related to media playback, such as play, pause, stop, seek, and complete, providing insights into user engagement with your media assets.
Parameter | Description |
---|---|
mediaId | (required) A unique id that is always the same while playing a media. As soon as the played media changes. |
mediaResource | (required) The URL of the media resource. |
mediaType | (required) video or audio depending on the type of the media. You can used MediaType.VIDEO or MediaType.AUDIO |
mediaTitle | The name / title of the media. |
playerName | The name of the media player, for example html5. |
mediaStatus | The time in seconds for how long a user has been playing this media. This number should typically increase when you send a media tracking request. It should be 0 if the media was only visible/impressed but not played. Do not increase this number when a media is paused. |
mediaLength | The duration (the length) of the media in seconds. For example if a video is 90 seconds long, the value should be 90. |
mediaProgress | The progress / current position within the media. Defines basically at which position within the total length the user is currently playing. |
mediaTTP | Defines after how many seconds the user has started playing this media. For example a user might have seen the poster of the video for 30 seconds before a user actually pressed the play button. |
mediaWidth | The resolution width of the media in pixels. Only recommended being set for videos. |
mediaHeight | The resolution height of the media in pixels. Only recommended being set for videos. |
mediaFullScreen | Should be 0 or 1 and defines whether the media is currently viewed in full screen. Only recommended being set for videos. |
mediaSE | An optional comma separated list of which positions within a media a user has played. For example if the user has viewed position 5s, 10s, 15s and 35s, then you would need to send 5,10,15,35. We recommend to round to the next 5 seconds and not send a value for each second. Internally, Matomo may round to the next 15 or 30 seconds. For performance optimisation we recommend not sending the same position twice. Meaning if you have sent ma_se=10 there is no need to send later ma_se=10,20 but instead only ma_se=20. |
trackMediaEvent({siteId:"siteid",mediaId:"unique id",mediaTitle:"video media play track",playerName:"test 08",mediaType:MediaType.VIDEO,mediaResource:"http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",mediaStatus:"100",mediaLength:"100",mediaFullScreen:"1",mediaHeight:"720",mediaWidth:"1080",mediaProgress:"100"});
Tracking campaigns usually involves recording information about user interactions that can be tied to specific marketing efforts, such as UTM parameters.It requires the parameters title
and campaignUrl
Campaign (Required): mtm_campaign
A descriptive name for the campaign, e.g. a blog post title or email campaign name.
Keyword (Recommended): mtm_keyword
The specific keyword that someone searched for, or category of interest.
(Available with Matomo Cloud or Marketing Campaigns Reporting Plugin)
Source (Recommended): mtm_source
The actual source of the traffic, e.g. newsletter, twitter, ebay, etc.
Medium (Recommended): mtm_medium
The type of marketing channel, e.g. email, social, paid, etc.
Content (Optional): mtm_content
This is a specific link or content that somebody clicked. e.g. banner, big-green-button
ID (Optional): mtm_cid
A unique identifier for your specific ad. This parameter is often used with the numeric IDs automatically generated by advertising platforms.
Group (Requires Matomo 4 or above): mtm_group
The audience your campaign is targeting e.g. customers, retargeting, etc
Placement (Requires Matomo 4 or above): mtm_placement
The placement on an advertising network e.g. newsfeed, sidebar, home-banner, etc.
If you already have URLs tagged with Google Analytics parameters these are also supported:
trackCampaign("Home screen","https://example.com/?mtm_campaign=2020_august_promo&mtm_source=google&mtm_medium=email&mtm_keyword=august promo&mtm_content=primary-cta")
Method | Required Parameter | Android | ios | Android TV | Apple TV |
---|---|---|---|---|---|
createTracker | uri: String, siteId: Number, token: String | ✅ | ✅ | ✅ | ✅ |
startSession | - | ✅ | ✅ | ✅ | ✅ |
trackScreen | screenName: String, title: String | ✅ | ✅ | ✅ | ✅ |
trackEvent | category:String, action:String, name:String, value:Number | ✅ | ✅ | ✅ | ✅ |
trackOutlink | url:String | ✅ | ✅ | ✅ | ✅ |
trackSearch | keyword:String | ✅ | ✅ | ✅ | ✅ |
trackImpression | contentName:String | ✅ | ✅ | ✅ | ✅ |
trackInteraction | contentName:String, contentInteraction:String | ✅ | ✅ | ✅ | ✅ |
trackDownload | category:String, action:String, url:String | ✅ | ✅ | ✅ | ✅ |
setUserId | id:String | ✅ | ✅ | ✅ | ✅ |
setVisitorId | visitorId:String | ✅ | ✅ | ✅ | ✅ |
trackDispatch | - | ✅ | ✅ | ✅ | ✅ |
disableTracking | - | ✅ | ✅ | ✅ | ✅ |
enableTracking | - | ✅ | ✅ | ✅ | ✅ |
setLogger | - | ✅ | ✅ | ✅ | ✅ |
trackMediaEvent | siteId: String, mediaId: String, mediaTitle: String, playerName: String, mediaType: String, mediaResource: String, mediaStatus: String,mediaLength?:String, mediaProgress?:String, mediaTTP?: String, mediaWidth?: String, mediaHeight?: String, mediaSE?: String, mediaFullScreen?:String | ✅ | ✅ | ✅ | ✅ |
trackCampaign | title: String, campaignUrl: String | ✅ | ✅ | ✅ | ✅ |
To generate a token_auth follow these steps:
Click on “Create new token” You will now see the newly created token. Save it somewhere safe as you won’t be able to see it anymore once you leave that screen. For example, save it in a password manager. If you lose it, you will need to generate a new token.
Made with create-react-native-library
FAQs
React-native plugin for matomo analytics
The npm package @logicwind/react-native-matomo-tracker receives a total of 41 weekly downloads. As such, @logicwind/react-native-matomo-tracker popularity was classified as not popular.
We found that @logicwind/react-native-matomo-tracker demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.