Socket
Socket
Sign inDemoInstall

@vercel/analytics

Package Overview
Dependencies
Maintainers
8
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vercel/analytics - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1-beta.0

24

dist/index.d.ts

@@ -5,6 +5,10 @@ interface PageViewEvent {

}
declare type Event = PageViewEvent;
interface CustomEvent {
type: 'event';
url: string;
}
declare type BeforeSendEvent = PageViewEvent | CustomEvent;
declare type Mode = 'auto' | 'development' | 'production';
declare type AllowedPropertyValues = string | number | boolean | null;
declare type BeforeSend = (event: Event) => Event | null;
declare type BeforeSend = (event: BeforeSendEvent) => BeforeSendEvent | null;
interface AnalyticsProps {

@@ -24,3 +28,19 @@ beforeSend?: BeforeSend;

/**
* Injects the Vercel Web Analytics script into the page head and starts tracking page views. Read more in our [documentation](https://vercel.com/docs/concepts/analytics/package).
* @param [props] - Analytics options.
* @param [props.mode] - The mode to use for the analytics script. Defaults to `auto`.
* - `auto` - Automatically detect the environment. Uses `production` if the environment cannot be determined.
* - `production` - Always use the production script. (Sends events to the server)
* - `development` - Always use the development script. (Logs events to the console)
* @param [props.debug] - Whether to enable debug logging in development. Defaults to `true`.
* @param [props.beforeSend] - A middleware function to modify events before they are sent. Should return the event object or `null` to cancel the event.
*/
declare function inject(props?: AnalyticsProps): void;
/**
* Tracks a custom event. Please refer to the [documentation](https://vercel.com/docs/concepts/analytics/custom-events) for more information on custom events.
* @param name - The name of the event.
* * Examples: `Purchase`, `Click Button`, or `Play Video`.
* @param [properties] - Additional properties of the event. Nested objects are not supported. Allowed values are `string`, `number`, `boolean`, and `null`.
*/
declare function track(name: string, properties?: Record<string, AllowedPropertyValues>): void;

@@ -27,0 +47,0 @@ declare const _default: {

2

dist/index.js
// package.json
var name = "@vercel/analytics";
var version = "1.0.0";
var version = "1.0.1-beta.0";

@@ -5,0 +5,0 @@ // src/queue.ts

@@ -5,6 +5,10 @@ interface PageViewEvent {

}
declare type Event = PageViewEvent;
interface CustomEvent {
type: 'event';
url: string;
}
declare type BeforeSendEvent = PageViewEvent | CustomEvent;
declare type Mode = 'auto' | 'development' | 'production';
declare type AllowedPropertyValues = string | number | boolean | null;
declare type BeforeSend = (event: Event) => Event | null;
declare type BeforeSend = (event: BeforeSendEvent) => BeforeSendEvent | null;
interface AnalyticsProps {

@@ -24,4 +28,33 @@ beforeSend?: BeforeSend;

/**
* Tracks a custom event. Please refer to the [documentation](https://vercel.com/docs/concepts/analytics/custom-events) for more information on custom events.
* @param name - The name of the event.
* * Examples: `Purchase`, `Click Button`, or `Play Video`.
* @param [properties] - Additional properties of the event. Nested objects are not supported. Allowed values are `string`, `number`, `boolean`, and `null`.
*/
declare function track(name: string, properties?: Record<string, AllowedPropertyValues>): void;
/**
* Injects the Vercel Web Analytics script into the page head and starts tracking page views. Read more in our [documentation](https://vercel.com/docs/concepts/analytics/package).
* @param [props] - Analytics options.
* @param [props.mode] - The mode to use for the analytics script. Defaults to `auto`.
* - `auto` - Automatically detect the environment. Uses `production` if the environment cannot be determined.
* - `production` - Always use the production script. (Sends events to the server)
* - `development` - Always use the development script. (Logs events to the console)
* @param [props.debug] - Whether to enable debug logging in development. Defaults to `true`.
* @param [props.beforeSend] - A middleware function to modify events before they are sent. Should return the event object or `null` to cancel the event.
* @example
* ```js
* import { Analytics } from '@vercel/analytics/react';
*
* export default function App() {
* return (
* <div>
* <Analytics />
* <h1>My App</h1>
* </div>
* );
* }
* ```
*/
declare function Analytics({ beforeSend, debug, mode, }: AnalyticsProps): null;

@@ -28,0 +61,0 @@

@@ -8,3 +8,3 @@ "use client";

var name = "@vercel/analytics";
var version = "1.0.0";
var version = "1.0.1-beta.0";

@@ -11,0 +11,0 @@ // src/queue.ts

{
"name": "@vercel/analytics",
"version": "1.0.0",
"version": "1.0.1-beta.0",
"keywords": [

@@ -8,2 +8,6 @@ "analytics",

],
"repository": {
"url": "github:vercel/analytics",
"directory": "packages/web"
},
"license": "MPL-2.0",

@@ -40,2 +44,5 @@ "type": "module",

],
"rules": {
"tsdoc/syntax": "off"
},
"ignorePatterns": [

@@ -42,0 +49,0 @@ "jest.setup.ts"

@@ -9,3 +9,3 @@ ![Analytics](https://github.com/vercel/analytics/blob/main/.github/banner.png)

<span> · </span>
<a href="https://vercel.com/docs/concepts/analytics/audiences/package">Documentation</a>
<a href="https://vercel.com/docs/concepts/analytics/package">Documentation</a>
<span> · </span>

@@ -17,3 +17,3 @@ <a href="https://twitter.com/vercel">Twitter</a>

`@vercel/analytics` allows you to track page views in your Next.js app or any other website that is deployed to Vercel.
`@vercel/analytics` allows you to track page views and custom events in your Next.js app or any other website that is deployed to Vercel.

@@ -32,3 +32,3 @@ All page views are automatically tracked in your app.

- For other frameworks, you can use the `inject` function add the tracking script to your app.
- If you want to use Vercel Web Analytics on a static site without npm, follow the instructions in the [documentation](https://vercel.com/docs/concepts/analytics/audiences/quickstart).
- If you want to use Vercel Web Analytics on a static site without npm, follow the instructions in the [documentation](https://vercel.com/docs/concepts/analytics/quickstart).

@@ -39,2 +39,2 @@ 4. Deploy your app to Vercel and see data flowing in.

Find more details about this package in our [documentation](https://vercel.com/docs/concepts/analytics/audiences/quickstart).
Find more details about this package in our [documentation](https://vercel.com/docs/concepts/analytics/quickstart).

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc