Drop this into your Clawdbot and it'll check your setup daily and alert you to any security issues.
Name: daily-security-audit
Schedule: 0 9 * * * (9am daily)
This client-side implementation provides a deterministic reference for customer login status in Shopify. Open the flems example by pressing the badge to see it in action:
| // Step 1. Add and initialize your third-party JavaScript pixel (make sure to exclude HTML) | |
| // Replace with you GA4 Tag | |
| const TAG_ID = 'G-XXXXXXXXXX'; | |
| const script = document.createElement('script'); | |
| script.setAttribute('src', `https://www.googletagmanager.com/gtag/js?id=${TAG_ID}`); | |
| script.setAttribute('async', ''); | |
| document.head.appendChild(script); | |
| window.dataLayer = window.dataLayer || []; |
| const browserSync = require('browser-sync'); | |
| const {getStoreValue, getThemeIdValue} = require('@shopify/slate-env'); | |
| const {getSSLKeyPath, getSSLCertPath} = require('../utilities'); | |
| class DevServer { | |
| constructor(options) { | |
| this.bs = browserSync.create(); | |
| this.target = `https://${getStoreValue()}`; | |
| this.themeId = getThemeIdValue(); | |
| this.port = options.port; |
| // Before implementing this, you'll need to contact Shopify support and ask them to turn off Google's ReCaptcha | |
| // for your Shopify store's contact forms. Otherwise, it will redirect to the captcha's verification page. | |
| // Retrieves input data from a form and returns it as a JSON object: | |
| function formToJSON(elements) { | |
| return [].reduce.call(elements, function (data, element) { | |
| data[element.name] = element.value; | |
| return data; | |
| }, {}); | |
| } |
| /* Build the Shopify Parameters | |
| //---------------------------------------*/ | |
| var action = '/contact?'; | |
| action += encodeURIComponent('form_type') +'='+ encodeURIComponent('contact'); | |
| action += '&'+ encodeURIComponent('utf8') +'='+ encodeURIComponent('✓'); | |
| action += '&'+ encodeURIComponent('contact[email]') +'='+ encodeURIComponent(contact_email); | |
| action += '&'+ encodeURIComponent('contact[body]') +'='+ encodeURIComponent(contact_body); | |
| /* Submit the form | |
| //---------------------------------------*/ |
| // Implementation in ES6 | |
| function pagination(c, m) { | |
| var current = c, | |
| last = m, | |
| delta = 2, | |
| left = current - delta, | |
| right = current + delta + 1, | |
| range = [], | |
| rangeWithDots = [], | |
| l; |