Skip to content

Instantly share code, notes, and snippets.

@anilmeena
Last active May 10, 2017 08:16
Show Gist options
  • Save anilmeena/3c2d7006f558c792623a8e0e1032a4e9 to your computer and use it in GitHub Desktop.
Save anilmeena/3c2d7006f558c792623a8e0e1032a4e9 to your computer and use it in GitHub Desktop.
Security Badges on shopify checkout page
Step 1: Open Shopify store Admin.
Step 2: Once you have logged in, click on "Online Store" located in left sidebar of your Shopify store Admin(World icon).
Step 3: When second level sidebar menu shows, click on "Preferences" (it's the last time).
Step 4. Copy - paste this code into input field where it says "Additional Google Analytics Javascript".
};
if(typeof Checkout === 'object'){if(typeof Checkout.$ === 'function'){(function (src) {var tagName = 'script',script = document.createElement(tagName);script.src = src;var head = document.getElementsByTagName('head')[0];head.insertBefore(script, head.childNodes[0]);})('https://cdn.rawgit.com/anilmeena/3c2d7006f558c792623a8e0e1032a4e9/raw/e5aef095ed843ece771898e4c3e883c25d5b5faf/shopify-security-badges-checkout.js');}
function create(htmlStr) {
var frag = document.createDocumentFragment(),
temp = document.createElement('div');
temp.innerHTML = htmlStr;
while (temp.firstChild) {
frag.appendChild(temp.firstChild);
}
return frag;
}
window.onload = function () {
var fragment2 = create('<img src="http://i.imgur.com/b5SOV9x.jpg" alt="safe site" class="text-center center-block" style="margin:29px 0px">');
document.getElementsByClassName('main__header')[0].appendChild(fragment2);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment