Custom Scripting

Custom Scripting in Redpen empowers users to embed their own scripts into their website via the Redpen widget. This feature enables users to integrate personalized functionalities, such as pop-ups, analytics tracking, or customized behavior, seamlessly into their web content. There is no need to update the entire website's code.

For instance, inserting a script like:

Copied to clipboard

	<script> alert('Something went wrong while loading the webpage')</script>
 

Pre-Requisites:

  1. The service must be connected to the redpen.To know how to connect service, click here.
  2. The widget must be created in the connected service.To know how to create widget, click here.

Add your custom script: Step-By-Step Guide

There are two ways to add your custom script.

Add your custom script from Widget Creation

1. Navigate to the Settings and click on Create Widget.

2. Provide the name of the widget.

3. Add your script to modify the changes you want.

Example: To display a simple alert when the widget loads, add the following script:

Copied to clipboard

	<script> alert('Something went wrong while loading the webpage')</script>
 

4. Select any template that aligns with your preferences.

5. Diligently follow the remaining steps to complete the widget creation process.

6. Copy the generated widget script from the last step.

7. Add widget script on the website.

  • Add the widget script to the HTML code on your website just before the </body> tag.

8. Finalize the process by publishing your website.

  • Once published, visit the website to witness and engage with the custom-scripted elements you've added.

Add your custom script from Widget Configuration

1. Access Widget Settings:

Open the Redpen Web app and select Widgets from the profile icon.

Alternatively, go to My Team, click on the three-dot menu, and access the Widgets option.

2. Select the Widget you want to add the custom script to.

3. Access the Widget configuration by clicking on the Configuration tab.

4. Add your script to modify the changes you want.

Example: To display a simple alert when the widget loads, add the following script:

Copied to clipboard

	<script> alert('Something went wrong while loading the webpage')</script>
 

5. Click the Save button to apply your changes.

6. Visit your website with the embedded Redpen widget to see your custom script in action.

Note: This is just a basic example. You can create complex scripts for various customizations.