- Go to your Shopify
admin/settings/filespage - Open your browser Dev tools, go to the console
Then, depending on the option you choose:
- Make sure your browser is set to download files automatically and doesn't ask for the download location every time
| var pageSpeedApiKey = 'PAGESPEED_API_KEY'; // use your api key here | |
| var urlToMonitor = 'YOUR_WEBSITE'; //replace with website you want to monitor | |
| var spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); | |
| var sheet = spreadsheet.getSheetByName('results'); | |
| function createHeaders() { | |
| //Freezes the first row | |
| sheet.setFrozenRows(1); | |
| // Set the values we want for headers | |
| var values = [["Timestamp", "Device","Performance Score","LAB FCP", "LAB LCP", "LAB CLS", "LAB Interactive", "LAB Total Blocking Time", "LAB Speed Index"]]; |
| (function () { | |
| function loadZendeskChat(callback) { | |
| var zdscript = document.createElement('script'); | |
| zdscript.setAttribute('id','ze-snippet'); | |
| zdscript.src = 'https://static.zdassets.com/ekr/snippet.js?key=XXX-XXX-XXX-XXX'; | |
| (document.getElementsByTagName('body')[0]).appendChild(zdscript); | |
| window.zdonload = setInterval(function(){ | |
| if(typeof zE !== "undefined" && typeof zE.activate !== "undefined") { |
| (function (context, trackingId, options) { | |
| const history = context.history; | |
| const doc = document; | |
| const nav = navigator || {}; | |
| const storage = localStorage; | |
| const encode = encodeURIComponent; | |
| const pushState = history.pushState; | |
| const typeException = 'exception'; | |
| const generateId = () => Math.random().toString(36); | |
| const getId = () => { |
admin/settings/files pageThen, depending on the option you choose:
| <script> | |
| /* Put this in theme.liquid, preferably right before "</body>" */ | |
| (function() { | |
| var discountParam = document.location.search.match(/discount=(\w+)/); | |
| if (discountParam && discountParam.length > 1) { | |
| document.cookie = discountParam[0]; | |
| } | |
| })(); | |
| </script> |
| {% comment %} | |
| To add a companion product to the cart automatically if a primary product is in cart: | |
| 1. Create a new link list under your Navigation tab. | |
| 2. In that link list, make the first link point to companion product. | |
| 3. Copy your link list handle where indicated at line 8: | |
| {% endcomment %} | |
| {% assign linklist = linklists['put-your-link-list-handle-here'] %} | |
| {% comment %} |
| (function() { | |
| var CSSCriticalPath = function(w, d, opts) { | |
| var opt = opts || {}; | |
| var css = {}; | |
| var pushCSS = function(r) { | |
| if(!!css[r.selectorText] === false) css[r.selectorText] = {}; | |
| var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/); | |
| for(var i = 0; i < styles.length; i++) { | |
| if(!!styles[i] === false) continue; | |
| var pair = styles[i].split(": "); |