--- title: "Custom JS" slug: "custom-js" updated: 2024-12-12T11:55:03Z published: 2024-12-12T11:55:03Z canonical: "docs.mapp.com/custom-js" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.mapp.com/llms.txt > Use this file to discover all available pages before exploring further. # Custom JS Custom JavaScript adds a powerful and flexible tool to Marketing Automation, enabling advanced customization and integration scenarios that go beyond the built-in features. With Custom JavaScript, you can trigger and execute JavaScript functions during web sessions, enhancing your campaigns’ interactivity and adaptability. --- ## Typical Use Cases for Custom JS Custom JavaScript is ideal for scenarios where standard solutions or content types are insufficient. Here are some potential applications: - **Dynamic Content Updates**: Modify or inject content dynamically on the webpage based on user behavior or real-time data. *Example*: Change page elements such as button text, images, or banners depending on the user segment or real-time behavior. - **Advanced Third-Party Integrations**: Seamlessly integrate third-party services, APIs, or widgets that require JavaScript. *Example*: Load a custom chatbot widget or trigger API calls to synchronize data with other platforms in real-time. - **Enhanced Personalization**: Apply unique business logic directly on the page to tailor the user experience. *Example*: Automatically populate form fields or change navigation menus based on user attributes. --- ## **Steps to Prepare and Create a Custom JS Campaign** ### Prepare the Foundation Before creating a Custom JavaScript campaign, ensure the following foundational elements are set up: 1. **Develop the JS Code** Prepare the JavaScript code that you want to execute. Ensure that it is optimized and securely written to prevent performance or security issues. 2. **Create a Custom JS Configuration** Go to *Contents > Custom JS* and click **Create a New Custom JS**. Configure the following: - **Name**: Enter a unique name for the banner for easy identification. - **JS Code**: Paste or write the desired JS code. --- ### Step 1: Create the Custom JS Campaign Once the foundation is set, you can create a Custom JS campaign: 1. Navigate to *Marketing Automation > Campaigns* and click **Create a New Campaign**. 2. Define the campaign elements: 1. **Target Group**: Select the audience segment you want to target. More information [here](/v1/docs/target-groups). 2. **Content**: Choose the Customer JS content you prepared earlier. 3. Save and activate your campaign. ### Step 2: Track Performance in Mapp Intelligence The analysis of performance metrics is available under the *Campaigns > Performance* tab. Here, you can view detailed metrics for your campaigns. For advanced analyses, click **Explore in Intelligence** to access additional metrics, apply filters, and perform deeper custom evaluations. Mapp Intelligence provides automatic tracking for key metrics, helping you evaluate their effectiveness: - **Views**: How often the banner is shown. - **Clicks**: Tracks user interactions with the banner. - **Conversions**: Tracks the number of desired user actions (e.g., purchases, sign-ups) completed. - **Engagement**: Measures subsequent page impressions after the banner is clicked. *(Note: Engagement tracking stops when the session ends or another banner/campaign is clicked.)* --- ## Managing Existing Custom JS To monitor and manage banners: - Navigate to *Contents > Custom JS* to view, edit, or delete existing custom JS.