Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@dotcms/experiments
Advanced tools
@dotcms/experiments
is the official dotCMS JavaScript library that helps add A/B testing to your webapps. It handle user assignments to different variants of a page and tracks their interactions.
You can install the package via npm or Yarn:
npm install @dotcms/experiments
Or using Yarn:
yarn add @dotcms/experiments
DotExperimentsProvider
This component utilizes React's Context API to provide DotExperiments instances to its descendants, facilitating access to A/B testing features throughout your webapps.
import { DotExperimentsProvider } from "@dotcms/experiments";
import { useRouter } from 'next/router';
const { replace } = useRouter();
const experimentConfig = {
apiKey: 'your-api-key-from-dotcms-analytics-app',
server: 'https://your-dotcms-instance.com',
redirectFn: replace // Use replace from useRouter in Next.js
};
return (
<DotExperimentsProvider config={experimentConfig}>
<Header>
<Navigation />
</Header>
<DotcmsLayout />
<Footer />
</DotExperimentsProvider>
);
The A/B testing process with @dotcms/experiments
is designed to be straightforward and automatic:
Experiment Assignment: When a user visits a page that includes an experiment, the library first checks if the user has been assigned to an experiment variant. If not, it queries DotCMS Analytics to determine if there are active experiments and assigns the user to the appropriate variant.
Page Redirection: If the user's assigned variant differs from the current page, the library automatically redirects the user to the correct variant page. This ensures that the user experiences the variant they have been assigned to.
Tracking Pageviews: After redirection or upon visiting the page, the library sends a pageview event to DotCMS Analytics. This data is used to determine the effectiveness of each variant, ultimately helping to identify which variant performs better in the A/B test.
For more detailed information on A/B testing features and capabilities, visit the DotCMS A/B testing and experiments page: DotCMS A/B Testing Experiments.
GitHub pull requests are the preferred method to contribute code to dotCMS. Before any pull requests can be accepted, an automated tool will ask you to agree to the dotCMS Contributor's Agreement.
dotCMS comes in multiple editions and as such is dual licensed. The dotCMS Community Edition is licensed under the GPL 3.0 and is freely available for download, customization and deployment for use within organizations of all stripes. dotCMS Enterprise Editions (EE) adds a number of enterprise features and is available via a supported, indemnified commercial license from dotCMS. For the differences between the editions, see the feature page.
If you need help or have any questions, please open an issue in the GitHub repository.
Always refer to the official DotCMS documentation for comprehensive guides and API references.
Source | Location |
---|---|
Installation | Installation |
Documentation | Documentation |
Videos | Helpful Videos |
Code Examples | Codeshare |
Forums/Listserv | via Google Groups |
@dotCMS | |
Main Site | dotCMS.com |
FAQs
Official JavaScript library to use Experiments with DotCMS.
The npm package @dotcms/experiments receives a total of 199 weekly downloads. As such, @dotcms/experiments popularity was classified as not popular.
We found that @dotcms/experiments 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
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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.