This article covers some frequently asked questions about using Amplitude with third-party website builders.
NOTE: These instructions may become outdated as the third-party platforms under discussion here make changes and upgrades. Amplitude's Support team will provide support for the instructions and processes contained in this article only; they cannot provide recommendations for anything not included here.
How do I instrument Amplitude on a third-party website builder?
Your website may not be natively built, but is instead built on a third-party website builder like Wix or Squarespace. Like a website built natively, most third-party website builders have an underlying code base you can use. Add Amplitude's Javascript SDK to that space, as if you were adding the SDK to your natively-built website. Generally, you will need to add the JS SDK snippet to the header and the rest of the JS SDK code in the body.
If you don't have access to the header or underlying source code for the third-party's website, you should still be able to use webhooks to combine a trigger or automation with an HTTP target to Amplitude's server-side endpoint - HTTP v2.
How do I instrument Amplitude on Wix?
Wix has a Tracking Tools & Analytics feature, which you can use to embed Amplitude’s JS SDK snippet and code to your site.
To do so, follow these steps:
- Go toSettings in your site's dashboard.
- Click the Tracking & Analytics tab, under Advanced Settings.
- Click + New Tool and select Custom.
- Set up your custom code:
- Enter your custom code.
- Select the relevant domain. This option will appear only if you have multiple domains.
- Enter a name for your custom code.
- Add Code to Pages: Select which pages to add your code to:
- All Pages: Click the dropdown and select either Load code once, or Load code on each new page.
- Choose specific pages: Begin typing the name of the relevant pages. Then click the checkbox next to the relevant page.
- Place Code in: Select where the code snippet in placed in your site's code.
- Head: this is where the JS SDK install snippet should be on every page you wish to track analytics.
- Body: this is where all other calls—logEvent, user properties—should go.
- Click Apply.
Some customers have told us that Wix allows you to add header scripts, but not to call functions from them. One suggested workaround is putting the necessary script in the Public folder.
Further reading on Wix
How do I instrument Amplitude on Squarespace?
Squarespace's Code Injection and Code Block features let you embed Amplitude’s JS SDK snippet and code to your site.
NOTE: These features may be premium features, only available in Business and Commerce plans.
Code Injection
Use Code Injection to add Amplitude’s JS SDK install snippet and other scripts that enhance specific parts of your site, like an order confirmation page.
To add JavaScript to a Code Injection field, surround the code with <script></script> tags. There are site-wide code injection and per-page code injection options. See this page for a per-page code injection option. If you add code to Code Injection, Squarespace may ask you to disable it while editing your site.
Next, add the JS SDK install snippet with Code Injection by following these steps:
- Open Code Injection. In the Home menu, navigate to Settings > Advanced > Code Injection.
- Add JS SDK code into the appropriate Code Injection fields for the header, footer, lock page, or order confirmation page.
- Header: Code added here is injected into the <head> tag on every page in your site.This is where the Amplitude JS SDK install snippet will be.
- Learn more about your other three options here.
- After adding your code, click Save.
Code Block
Use Code Block to set up logEvent, user properties etc calls. To add JavaScript to a Code Block field, surround the code with <script></script> tags.
To add a Code Block, follow these steps:
- Edit a page or post, click an insert point, and select Code from the menu. For help, visit Adding content with blocks.
- Add your code in the text field: see our Using the SDKs documentation for the event and properties calls.
- If you're using the Code Block to display code snippets, check Display Source.
- Click Apply to save your changes.