Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
google-analytics-protocol
Advanced tools
A tiny library that reimplements Google Analytics calls using the [Google Analytics Measurement Protocol](https://developers.google.com/analytics/devguides/collection/protocol/v1/).
A tiny library that reimplements Google Analytics calls using the Google Analytics Measurement Protocol.
Google's own analytics JS file requires a number of browser features, like cookies and XHR. Service
Workers do not have access to cookies, localStorage and the like, and we also want to be more
deliberate about versioning and caching when it comes to Service Workers. So this is a "fresh"
rewrite, using fetch
and IndexedDB.
Since this is designed for use inside Service Workers I haven't added any shims for older
browsers. So it requires IndexedDB, fetch
and Promise support.
Again, given the Service Worker nature of what we're doing, it caches analytics calls inside the IndexedDB, so if it cannot connect to the GA server it'll store requests offline and try the next time an analytics call is made.
The actual call itself is very basic and uses the attributes specified in the protocol reference.
Use setAnalyticsID()
to specify your ID before trying to send any calls.
import Analytics from 'google-analytics-protocol';
Analytics.setAnalyticsID(GA_ID);
Analytics({
t: 'pageview',
dh: 'localhost.com',
dp: '/index.html'
})
FAQs
A tiny library that reimplements Google Analytics calls using the [Google Analytics Measurement Protocol](https://developers.google.com/analytics/devguides/collection/protocol/v1/).
The npm package google-analytics-protocol receives a total of 1 weekly downloads. As such, google-analytics-protocol popularity was classified as not popular.
We found that google-analytics-protocol demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.