Add AppFit to your Webflow site
First things first, you need to have access to your Webflow account and be able to edit the header code.
Sign up for an AppFit account and create your Company
Be sure to choose the right Industry, Platform, and Focus. AppFit will recommend which metrics you should track based on your answers to these questions.
Select Integrations from the Menu
For now, you can get your API Key from going into either Amplitude or Segment integration and copying it there
Log into your Webflow account and select Site Settings for the site where you want to add AppFit
In Site Settings, add the following code to your Head code
<script>
window.AppFit = {
cache: {},
trackEvent(eventName, payload) {
if (!window.AppFit.cache) {
window.AppFit.cache = {}
}
if (!window.AppFit.cache.events) {
window.AppFit.cache.events = [];
}
window.AppFit.cache.events.push({ eventName: eventName, payload: payload })
return Promise.resolve();
},
identifyUser(userId) {
if (!window.AppFit.cache) {
window.AppFit.cache = {}
}
window.AppFit.cache.identity = userId;
}
};
function startAppFit(apiKey) {
window.AppFit.apiKey = apiKey;
var script = document.createElement('script');
script.type = 'module';
script.src = 'https://d1433kipn7zjh1.cloudfront.net/appfit.js';
var fallbackScript = document.createElement('script');
fallbackScript.noModule = true;
fallbackScript.src = 'https://d1433kipn7zjh1.cloudfront.net/appfit-legacy.js';
var first = document.getElementsByTagName('script')[0];
first.parentNode.insertBefore(script, first);
first.parentNode.insertBefore(fallbackScript, first);
}
startAppFit('WRITE KEY');
</script>
<script>
window.AppFit.trackEvent('screen_viewed', { screen: window.location.pathname })
</script>
Click Publish and your website events should appear in AppFit, where you can map them to the appropriate metrics
Your metrics will begin to automatically update as soon as AppFit receives data.