]> khamidou — GitHub mirrors - segment-playground.git/commitdiff
add analytics.js
authorKarim Hamidou <khamidou@gmail.com>
Wed, 14 Jul 2021 00:30:16 +0000 (17:30 -0700)
committerKarim Hamidou <khamidou@gmail.com>
Wed, 14 Jul 2021 00:30:16 +0000 (17:30 -0700)
index.html

index 0df2164d647241001bc32fc0fde133b765a73221..d5c815bfb0fc187009a425f6d9f3d290c6a4ecf0 100644 (file)
-
 <!DOCTYPE html> 
-
 <html> 
-<head> 
-<title>Home Questionnaire<span id="selection-marker-1" class="redactor-selection-marker"></span></title> 
-</head> 
+    <head> 
+        <title>Home Questionnaire<span id="selection-marker-1" class="redactor-selection-marker"></span></title> 
+        <script>
+          !function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on","addSourceMiddleware","addIntegrationMiddleware","setAnonymousId","addDestinationMiddleware"];analytics.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(e);analytics.push(t);return analytics}};for(var e=0;e<analytics.methods.length;e++){var key=analytics.methods[e];analytics[key]=analytics.factory(key)}analytics.load=function(key,e){var t=document.createElement("script");t.type="text/javascript";t.async=!0;t.src="https://cdn.segment.com/analytics.js/v1/" + key + "/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n);analytics._loadOptions=e};analytics._writeKey="xl0N1QVsoEn1kjNbbYlpjlh93eKEPmAO";analytics.SNIPPET_VERSION="4.13.2";
+  analytics.load("xl0N1QVsoEn1kjNbbYlpjlh93eKEPmAO");
+  analytics.page();
+  }}();
+    </script>
+    </head> 
 
-<body> 
-<h1>What is your favorite place to travel?</h1> 
-<p>I am building a directory of the sweetest travel destinations.</p> 
+    <body> 
+        <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"/> 
-<br><br><br> 
-Any recommendations (cool things to do, places to visit or restaurants to eat)? 
-<br><br> 
-<textarea cols="81" name="details" required="" rows="10"> </textarea> 
-<br><br> 
-Name: <input name="fullname" required="" size="75" type="text"/> 
-<br><br> 
-Email: <input name="email" required="" size="75" type="email"/> 
-<br><br> <input name="submit" type="submit" value="submit"/> </form> 
+        <form name="travel" onsubmit="identify(event)"> What is your favorite travel destination? <input name="destination" required="" size="81" type="text"/> 
+            <br><br><br> 
+            Any recommendations (cool things to do, places to visit or restaurants to eat)? 
+            <br><br> 
+            <textarea cols="81" name="details" required="" rows="10"> </textarea> 
+            <br><br> 
+            Name: <input name="fullname" required="" size="75" type="text"/> 
+            <br><br> 
+            Email: <input name="email" required="" size="75" type="email"/> 
+            <br><br> <input name="submit" type="submit" value="submit"/> </form> 
 
-<script type="text/javascript"> 
-  function identify(e){ 
+        <script type="text/javascript"> 
+            function identify(e){ 
 
-    e.preventDefault(); 
-    var form = e.target; 
-    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 
-    }; 
-    // Placeholder for an Identify call
-    analytics.identify('1234', { 
-      email: email, 
-      name: fullname 
-    }); 
-    // Placeholder for a Track call
-    analytics.track('destination submitted', user, function() { 
-      window.location.href = ""; 
-    });
+                            e.preventDefault(); 
+                            var form = e.target; 
+                            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 
+                                        }; 
+                            // Placeholder for an Identify call
+                            analytics.identify('1234', { 
+                                            email: email, 
+                                            name: fullname 
+                                        }); 
+                            // Placeholder for a Track call
+                            analytics.track('destination submitted', user, function() { 
+                                            window.location.href = ""; 
+                                        });
 
-    // // Ecommerce Events
-    // analytics.track('Products Searched', { 
-    //  query: 'monopoly' 
-    // });
+                            // // Ecommerce Events
+                            // analytics.track('Products Searched', { 
+                            //  query: 'monopoly' 
+                            // });
 
-    // analytics.track('Product List Viewed', { 
-    //   list_id: 'hot_deals_1', 
-    //   category: 'Deals', 
-    //   products: [ { 
-    //     product_id: '507f1f77bcf86cd799439011', 
-    //     sku: '45790-32', 
-    //     name: 'Monopoly: 3rd Edition', 
-    //     price: 19, 
-    //     position: 1, 
-    //     category: 'Games', 
-    //     url: 'https://www.example.com/product/path', 
-    //     image_url: 'https://www.example.com/product/path.jpg' 
-    //   }, { 
-    //     product_id: '505bd76785ebb509fc183733', 
-    //     sku: '46493-32', 
-    //     name: 'Uno Card Game', 
-    //     price: 3, 
-    //     position: 2, 
-    //     category: 'Games' 
-    // } ] });
+                            // analytics.track('Product List Viewed', { 
+                            //   list_id: 'hot_deals_1', 
+                            //   category: 'Deals', 
+                            //   products: [ { 
+                            //     product_id: '507f1f77bcf86cd799439011', 
+                            //     sku: '45790-32', 
+                            //     name: 'Monopoly: 3rd Edition', 
+                            //     price: 19, 
+                            //     position: 1, 
+                            //     category: 'Games', 
+                            //     url: 'https://www.example.com/product/path', 
+                            //     image_url: 'https://www.example.com/product/path.jpg' 
+                            //   }, { 
+                            //     product_id: '505bd76785ebb509fc183733', 
+                            //     sku: '46493-32', 
+                            //     name: 'Uno Card Game', 
+                            //     price: 3, 
+                            //     position: 2, 
+                            //     category: 'Games' 
+                            // } ] });
 
-    // analytics.track('Product Viewed', {
-    //   product_id: '507f1f77bcf86cd799439011',
-    //   sku: 'G-32',
-    //   category: 'Games',
-    //   name: 'Monopoly: 3rd Edition',
-    //   brand: 'Hasbro',
-    //   variant: '200 pieces',
-    //   price: 18.99,
-    //   quantity: 1,
-    //   coupon: 'MAYDEALS',
-    //   currency: 'usd',
-    //   position: 3,
-    //   value: 18.99,
-    //   url: 'https://www.example.com/product/path',
-    //   image_url: 'https://www.example.com/product/path.jpg'
-    // });
+                            // analytics.track('Product Viewed', {
+                            //   product_id: '507f1f77bcf86cd799439011',
+                            //   sku: 'G-32',
+                            //   category: 'Games',
+                            //   name: 'Monopoly: 3rd Edition',
+                            //   brand: 'Hasbro',
+                            //   variant: '200 pieces',
+                            //   price: 18.99,
+                            //   quantity: 1,
+                            //   coupon: 'MAYDEALS',
+                            //   currency: 'usd',
+                            //   position: 3,
+                            //   value: 18.99,
+                            //   url: 'https://www.example.com/product/path',
+                            //   image_url: 'https://www.example.com/product/path.jpg'
+                            // });
 
-    // analytics.track('Product Added', {
-    //   cart_id: 'skdjsidjsdkdj29j',
-    //   product_id: '507f1f77bcf86cd799439011',
-    //   sku: 'G-32',
-    //   category: 'Games',
-    //   name: 'Monopoly: 3rd Edition',
-    //   brand: 'Hasbro',
-    //   variant: '200 pieces',
-    //   price: 18.99,
-    //   quantity: 1,
-    //   coupon: 'MAYDEALS',
-    //   position: 3,
-    //   url: 'https://www.example.com/product/path',
-    //   image_url: 'https://www.example.com/product/path.jpg'
-    // });
+                            // analytics.track('Product Added', {
+                            //   cart_id: 'skdjsidjsdkdj29j',
+                            //   product_id: '507f1f77bcf86cd799439011',
+                            //   sku: 'G-32',
+                            //   category: 'Games',
+                            //   name: 'Monopoly: 3rd Edition',
+                            //   brand: 'Hasbro',
+                            //   variant: '200 pieces',
+                            //   price: 18.99,
+                            //   quantity: 1,
+                            //   coupon: 'MAYDEALS',
+                            //   position: 3,
+                            //   url: 'https://www.example.com/product/path',
+                            //   image_url: 'https://www.example.com/product/path.jpg'
+                            // });
 
-    // analytics.track('Order Completed', {
-    //   checkout_id: 'fksdjfsdjfisjf9sdfjsd9f',
-    //   order_id: '50314b8e9bcf000000000000',
-    //   affiliation: 'Google Store',
-    //   total: 27.50,
-    //   subtotal: 22.50,
-    //   revenue: 25.00,
-    //   shipping: 3,
-    //   tax: 2,
-    //   discount: 2.5,
-    //   coupon: 'hasbros',
-    //   currency: 'USD',
-    //   products: [
-    //     {
-    //       product_id: '507f1f77bcf86cd799439011',
-    //       sku: '45790-32',
-    //       name: 'Monopoly: 3rd Edition',
-    //       price: 19,
-    //       quantity: 1,
-    //       category: 'Games',
-    //       url: 'https://www.example.com/product/path',
-    //       image_url: 'https:///www.example.com/product/path.jpg'
-    //     }
-    //   ]
-    // });
-  }
+                            // analytics.track('Order Completed', {
+                            //   checkout_id: 'fksdjfsdjfisjf9sdfjsd9f',
+                            //   order_id: '50314b8e9bcf000000000000',
+                            //   affiliation: 'Google Store',
+                            //   total: 27.50,
+                            //   subtotal: 22.50,
+                            //   revenue: 25.00,
+                            //   shipping: 3,
+                            //   tax: 2,
+                            //   discount: 2.5,
+                            //   coupon: 'hasbros',
+                            //   currency: 'USD',
+                            //   products: [
+                            //     {
+                            //       product_id: '507f1f77bcf86cd799439011',
+                            //       sku: '45790-32',
+                            //       name: 'Monopoly: 3rd Edition',
+                            //       price: 19,
+                            //       quantity: 1,
+                            //       category: 'Games',
+                            //       url: 'https://www.example.com/product/path',
+                            //       image_url: 'https:///www.example.com/product/path.jpg'
+                            //     }
+                            //   ]
+                            // });
+                        }
 
-</script> 
+        </script> 
 
-</body> 
+    </body> 
 </html>