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.


    <title>Home Questionnaire</title> <span id="selection-marker-1" class="redactor-selection-marker"></span>
<h1>What is your favorite place to travel?</h1> 
<p>I am building a directory of the sweetest travel destinations.</p>  
<form name="travel" onsubmit="identify(event)">
     What is your favorite travel destination?
    <input name="destination" required="" size="81" type="text"/> 
    Any recommendations (cool things to do, places to visit or restaurants to eat)? 
    <textarea cols="81" name="details" required="" rows="10">
    Name: <input name="fullname" required="" size="75" type="text"/> 
    Email: <input name="email" required="" size="75" type="email"/> 
    <input name="submit" type="submit" value="submit"/>
 <!--  Div Below is where consent manager will be injected to  -->
  <div id="target-container"></div>




                //code below loads consentManagerConfig object and specifies content popup contains. Need to update with your own writeKey and what container code should be injected to, I am using empyty div 

//note, may need to view demo in debug mode to save tracking preferences in browser

window.consentManagerConfig = function(exports) {
   //creating our custome category object
   var customCategories = {
          'Analytics': {
             integrations: ['Google Analytics','Mixpanel','Amplitude'], 
             purpose: 'Provide statistical information on site usage, e.g., web analytics so we can improve this website over time.'          
          'Functional': {
            integrations: ['Salesforce Marketing Cloud','Visual Tagger'], 
            purpose: 'Enables enhanced functionality, such as videos and live chat. If you do not allow these, then some or all of these functions may not work properly.'    
          'Do Not Sell': {
             integrations: ['Salesforce', 'MailChimp', 'AdWords'], 
             purpose:'To give the right to opt out of the sale of personal data.'
  //this will set which category of tools are opted in/out of by default
    var initialPrefs = {
        'Functional': true,
        'Analytics': false,
        'Do Not Sell': false }; 
         var prefs = {
          container: '#target-container', 
          //passing in our customCategories object to consentManagerConfig
          customCategories: customCategories,
          //passing in our initial preferences object to consentManagerConfig
          initialPreferences: initialPrefs, 
          writeKey: 'VuOZbPNXuR76IXTQeYaU6twg3qpSNAw9',
          bannerContent: 'User consent is awesome! We use cookies (and other similar technologies) to collect data to improve your experience on our site.',
          bannerSubContent: 'You can change your preferences at any time.',
          cancelDialogContent: 'Your preferences have not been saved. By continuing to use our website, you are agreeing to our Website Data Collection Policy',
          cancelDialogTitle: 'Are you sure you want to cancel?',
          closeBehavior: 'accept',
          implyConsentOnInteraction: false,
          preferencesDialogContent: 'We use data collected by cookies and JavaScript libraries, which are necessary for website functioning, to improve user’s browsing experience, analyze site traffic, deliver personalized advertisements, and increase the overall performance of our site.',
          preferencesDialogTitle: 'Website Data Collection Preferences'
        return prefs; 

<!--script that loads Prebuilt Consent Manager UI via Preact, note using version 5.0.0-->
 <script src="[email protected]/standalone/consent-manager.js" defer> </script>

<!--Load Analytics.js-->
        !(function() {
          var analytics = ( = || [])
          if (!analytics.initialize)
            if (analytics.invoked)
              window.console && console.error && console.error('Segment snippet included twice.')
            else {
              analytics.invoked = !0
              analytics.methods = [
                //methods below needed for consent manager version 5.0.0 and greater!!
              analytics.factory = function(t) {
                return function() {
                  var e =
                  return analytics
              for (var t = 0; t < analytics.methods.length; t++) {
                var e = analytics.methods[t]
                analytics[e] = analytics.factory(e)
              analytics.load = function(t, e) {
                var n = document.createElement('script')
                n.type = 'text/javascript'
                n.async = !0
                n.src =
                  ('https:' === document.location.protocol ? 'https://' : 'http://') +
                  '' +
                  t +
                var o = document.getElementsByTagName('script')[0]
                o.parentNode.insertBefore(n, o)
                analytics._loadOptions = e
              analytics.SNIPPET_VERSION = '4.1.0'

<!--Javascript that controls form submits and mapping user input data to Segment Analytics.js methods-->
<script type="text/javascript">
    function identify(e){
      var form =;
      var email = form["email"].value;
      var fullname = form["fullname"].value;
      var destination = form["destination"].value;
      var details = form["details"].value;
      var user = {
          email: email, 
          name: fullname, 
          destination: destination, 
          details: details
      analytics.identify('1234', {
          email: email, 
          name: fullname
      analytics.track('destination submitted', user, function() {
          window.location.href = "";
      });'Home', user, {
        url: "/" 
      analytics.alias('507f191e81');"0e8c78ea9d97a7b8185e8632", {
            name: "Initech", 
            industry: "Technology",
            employees: 329, 
            plan: "enterprise", 
            "total billed": 830