Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <!DOCTYPE html>
  <title>URL Builder</title>
  <link rel="stylesheet" href="" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">

  .form-side-margin {
    margin: 0 40px;
  .button-spacing {
    margin-top: 40px;
<form id="url-form" class="my-5 form-side-margin">
    <label for="base-url">URL base:</label>
    <input type="text" id="base-url" class="form-control" required>
    <label for="source">Fuente:</label>
    <input type="text" id="source" class="form-control" required>
    <label for="medium">Medio:</label>
    <input type="text" id="medium" class="form-control" required>
    <label for="campaign">Campaña:</label>
    <input type="text" id="campaign" class="form-control" required>
 <button type="submit" class="btn btn-primary button-spacing">Crear URL</button>
  <div id="output" class="alert alert-primary"></div>
    // Obtén una referencia al formulario y al elemento de salida
    const form = document.getElementById('url-form');
    const output = document.getElementById('output');

    // Añade un manejador de envío al formulario
    form.addEventListener('submit', e => {
      // Previene que la página se recargue

      // Obtén los valores de los campos de entrada
      const baseUrl = document.getElementById('base-url').value;
      const source = document.getElementById('source').value;
      const medium = document.getElementById('medium').value;
      const campaign = document.getElementById('campaign').value;

      // Construye la URL con los tags de seguimiento
      const trackingUrl = `${baseUrl}?utm_source=${source}&utm_medium=${medium}&utm_campaign=${campaign}`;

      // Muestra la URL en el elemento de salida
      output.innerHTML = `<a href="${trackingUrl}">${trackingUrl}</a>`;