diff --git a/core-web/libs/sdk/analytics/.babelrc b/core-web/libs/sdk/analytics/.babelrc
new file mode 100644
index 000000000000..f7b3a9bece5a
--- /dev/null
+++ b/core-web/libs/sdk/analytics/.babelrc
@@ -0,0 +1,12 @@
+{
+ "presets": [
+ [
+ "@nx/react/babel",
+ {
+ "runtime": "automatic",
+ "useBuiltIns": "usage"
+ }
+ ]
+ ],
+ "plugins": []
+}
diff --git a/core-web/libs/sdk/analytics/.eslintrc.json b/core-web/libs/sdk/analytics/.eslintrc.json
index 4cfe38bd218c..ef536cdfaf37 100644
--- a/core-web/libs/sdk/analytics/.eslintrc.json
+++ b/core-web/libs/sdk/analytics/.eslintrc.json
@@ -13,13 +13,6 @@
{
"files": ["*.js", "*.jsx"],
"rules": {}
- },
- {
- "files": ["*.json"],
- "parser": "jsonc-eslint-parser",
- "rules": {
- "@nx/dependency-checks": "error"
- }
}
]
}
diff --git a/core-web/libs/sdk/analytics/.swcrc b/core-web/libs/sdk/analytics/.swcrc
deleted file mode 100644
index f416bd669484..000000000000
--- a/core-web/libs/sdk/analytics/.swcrc
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "jsc": {
- "target": "es2017",
- "parser": {
- "syntax": "typescript",
- "decorators": true,
- "dynamicImport": true
- },
- "transform": {
- "decoratorMetadata": true,
- "legacyDecorator": true
- },
- "keepClassNames": true,
- "externalHelpers": true,
- "loose": true
- },
- "module": {
- "type": "es6"
- },
- "sourceMaps": true,
- "exclude": [
- "jest.config.ts",
- ".*\\.spec.tsx?$",
- ".*\\.test.tsx?$",
- "./src/jest-setup.ts$",
- "./**/jest-setup.ts$",
- ".*.js$"
- ]
-}
\ No newline at end of file
diff --git a/core-web/libs/sdk/analytics/README.md b/core-web/libs/sdk/analytics/README.md
index 5338b9d2af67..d62334579aec 100644
--- a/core-web/libs/sdk/analytics/README.md
+++ b/core-web/libs/sdk/analytics/README.md
@@ -1,39 +1,115 @@
# @dotcms/analytics
-`@dotcms/analytics` is the official dotCMS JavaScript library for Content Analytics that helps track events and analytics in your webapps. Currently available as an IIFE (Immediately Invoked Function Expression) module for direct browser usage.
+`@dotcms/analytics` is the official dotCMS JavaScript library for Content Analytics that helps track events and analytics in your webapps. Available for both browser and React applications.
## Features
- **Simple Browser Integration**: Easy to implement via script tags using IIFE implementation
+- **React Support**: Built-in React components and hooks for seamless integration
- **Event Tracking**: Simple API to track custom events with additional properties
- **Automatic PageView**: Option to automatically track page views
- **Debug Mode**: Optional debug logging for development
## Installation
-Include the script in your HTML page:
+```bash
+npm install @dotcms/analytics
+```
+
+Or include the script in your HTML page:
```html
-
+
```
-## Configuration
+## React Integration
-The script can be configured using data attributes:
+### Provider Setup
+
+First, import the provider:
+
+```tsx
+import { DotContentAnalyticsProvider } from '@dotcms/analytics/react';
+```
+
+Wrap your application with the `DotContentAnalyticsProvider`:
+
+```tsx
+// Example configuration
+const analyticsConfig = {
+ apiKey: 'your-api-key-from-dotcms-analytics-app',
+ server: 'https://your-dotcms-instance.com',
+ debug: false // Not required
+};
+
+function App() {
+ return (
+