How-to
How to embed Google wallet or Apple wallet button on Squarespace
On Squarespace, start with a text link or button that opens the pass URL. Use an Embed block and the badge snippet only when you want the Apple Wallet and Google Wallet artwork. Site-wide button setup is in the embed guide.
The snippet in this article swaps the image from the browser. Safari is set to the Apple Wallet badge. Chrome is set to the Google Wallet badge. The click opens the pass link you paste into buttonUrl.


Use a plain link
- Create the pass and copy its link from the copy icon.
- In the Squarespace editor, add a text link or button and set the URL to that pass link.
- Publish the page.

If the editor does not offer Code snippet on the page you are editing, keep this link. This article does not name a Squarespace plan requirement.
1. Open the Squarespace editor and click Add Block

2. Search for Embed and select Embed

3. Select the edit button

4. Choose Code snippet

5. Paste the snippet and set the pass link
Paste the snippet below into the code snippet field. Replace buttonUrl with the pass link from the copy icon. The address in the sample is a placeholder, not a live pass.
<script>
window.onload = function() {
// Paste the pass link here in the button url string
const buttonUrl="https://app.addtowallet.co/card/........";
var button = document.getElementById("addToWalletButton");
var userAgent = window.navigator.userAgent;
var img = document.getElementById("walletImage");
if (userAgent.indexOf("Chrome") != -1 && userAgent.indexOf("Safari") != -1 && userAgent.indexOf("Edg") == -1) {
img.src = "https://s3.amazonaws.com/i.addtowallet.co/assets/Add_to_Google_Wallet_badge.svg.png";
} else if (userAgent.indexOf("Safari") != -1 && userAgent.indexOf("Chrome") == -1) {
img.src = "https://s3.amazonaws.com/i.addtowallet.co/assets/add_to_apple_wallet.png";
} else {
img.src = "https://s3.amazonaws.com/i.addtowallet.co/assets/Add_to_Google_Wallet_badge.svg.png";
}
button.style.background = 'none';
button.style.border='none';
button.style.width = '250px';
button.style.height = '72px';
img.style.width = '100%';
img.style.height = '100%';
button.style.cursor = 'pointer';
button.onmousedown = function() {
button.style.transform = 'scale(0.9)';
}
button.onmouseup = function() {
button.style.transform = 'scale(1)';
}
button.onclick = function() {
window.open(buttonUrl, '_blank');
}
}
</script>
<button id="addToWalletButton">
<img id="walletImage" src="" alt="addToWalletButton"/>
</button>
6. Preview, then publish
Click preview in safe mode, the preview step shown in this article, and confirm the badge is on the page. Then publish.


Check the published page on a phone
Publish the page, open the live URL on a phone, and tap the link or button. Confirm the pass page opens. Write down the phone model and the browser you used. This article does not publish a device result.
Create Wallet Pass Now