# Analytics Source: https://docs.getmocha.com/basics/analytics Understand your app's traffic: visitors, pageviews, sources, top pages, locations, and devices Mocha Analytics helps you understand how people find and use your app. ## Where To Find Analytics In the Mocha app, click the **Analytics** tab in the top menu. Analytics tab in Mocha ## Availability And Lookback Window Analytics is available for **published apps** (including apps on a Mocha subdomain, not only custom domains). It is **not available on the free tier**. How far back you can view analytics depends on your plan: | Plan | History you can view | | ------ | -------------------- | | Bronze | 15 days | | Silver | 60 days | | Gold | 2 years | Privacy note: Mocha does not use cookies or track visitors across websites. Visitor counts use an anonymous identifier that resets every day. ## Visitors **Unique visitors**: The number of people who visited your app during the selected time period. If someone visits multiple pages in one session, they are still counted as one visitor. Because the anonymous visitor identifier resets daily, the same person visiting on two different days will be counted as two unique visitors. Visitors using different devices (for example phone and laptop) are also counted separately since there is no cross-device tracking. **Total pageviews**: The total number of pages loaded across all visitors. If one person views 5 pages, that counts as 5 pageviews. **Current visitors**: The number of people on your app right now (within the last 30 minutes). This updates in real time regardless of the date range you have selected. ## Sources and Campaigns **Sources** show where your visitors came from before landing on your app. For example, if someone clicks a link to your app from Instagram, the source may show `instagram.com`. If someone clicks a link from Google search results, it may show `google.com`. **Campaigns** let you attribute traffic to specific marketing links by using UTM parameters. For example: ```text theme={null} https://your-app.example/?utm_source=twitter&utm_campaign=launch ``` Mocha supports five UTM tags: * **Source** (`utm_source`): where the link was posted (e.g. `twitter`, `newsletter`) * **Medium** (`utm_medium`): the type of channel (e.g. `social`, `email`) * **Campaign** (`utm_campaign`): the name of your campaign (e.g. `launch`, `summer-sale`) * **Content** (`utm_content`): differentiate similar links in the same campaign * **Term** (`utm_term`): identify keywords in paid search campaigns ## Top Pages **Top pages** show which pages of your app get the most visitors. Each entry shows the page path (the part of the URL after your domain) and how many unique visitors viewed it. ## Locations **Locations** show where your visitors are located, broken down by country, region, and city. This is determined from the visitor's internet connection and is approximate. It does not use GPS or precise location tracking. ## Devices Analytics breaks device information down into: * **Browsers**: Chrome, Safari, Firefox, etc. * **Operating systems**: Windows, macOS, iOS, Android, etc. * **Devices**: desktop, mobile, or tablet. # Using Images and Assets Source: https://docs.getmocha.com/basics/assets Learn how to upload, manage, and use assets in your Mocha projects Mocha makes it easy to work with images, screenshots, and other assets in your projects. You can upload assets directly in the chat, manage them in project settings, and use them to enhance your website. ## Uploading Assets in Chat You can upload assets directly in the chat interface. The AI will intelligently determine how to use them based on your request. Uploading an asset in chat ### Common Use Cases * **Inspiration & Design**: Upload screenshots of websites you like for the AI to use as design inspiration * **Content Creation**: Share images for your portfolio, blog posts, or product pages * **Problem Solving**: Show screenshots of issues you want to fix or improve * **Asset Integration**: Upload images to be used as backgrounds, profile pictures, or featured content ### Example Prompts "Build a portfolio with this image as the main vibe" "Use this as the background for the hero section" "The spacing here looks off, can you fix it?" ## Reusing Uploaded Assets Once you've uploaded assets to your project, you can easily reuse them in future conversations using the + button in the chat interface. Selecting assets ## Managing Assets You can manage all your project's assets in the project settings. Here you can: * Upload new assets * Rename existing assets * Add descriptions * Delete assets Managing assets Adding descriptions to your assets helps the AI understand and use them more effectively in your project. ## Storage Limits All Mocha accounts come with asset storage, but subscribers get significantly more space: * 🆓 **Free**: 100MB storage * đŸ„‰ **Bronze**: 1GB storage * đŸ„ˆ **Silver**: 2GB storage * đŸ„‡ **Gold**: 10GB storage Need more storage? Consider upgrading your subscription to get more space for your assets. # Authentication Source: https://docs.getmocha.com/basics/auth Built‑in auth with Google: add sign‑in and protect pages and actions Mocha includes a built‑in authentication module. Today it supports Google sign‑in via our Mocha provider. You can enable auth simply by asking the AI to add it. Ask: “Add authentication and a sign‑in button.” The AI will set up sign‑in/out flows and guard protected pages and actions. No. Mocha's provider handles the Google OAuth flow. Just ask the AI to enable authentication. Not yet. Multiple providers and scopes are on our roadmap. For now, Google is supported out of the box. Email/password and username/password authentication are not directly supported yet. While Mocha can sometimes build custom auth flows, it often makes mistakes with security-critical code. We strongly recommend sticking with Google authentication—it's a solid, secure mechanism that works reliably. We plan to add native email/password support soon. Yes, if you're on a Silver or Gold plan. By default, users see "Mocha" in the Google sign-in screen. With your own credentials, they'll see your app's name and logo instead. Learn more in [Customize Google Sign In](/basics/custom-oauth-clients). *** ## More Authentication Questions Google authentication is currently the only officially supported option because: * **It's secure** - Google handles the security-critical parts like password storage and two-factor auth * **It's reliable** - Fewer things can go wrong compared to custom auth systems * **It's familiar** - Most users already have a Google account We're working on adding more authentication options, including email/password, in the future. Phone number authentication isn't currently supported as a built-in feature. While you could potentially ask the AI to build something custom using a service like Twilio, we don't officially support this and can't guarantee it will work correctly. For now, we recommend using Google authentication for the most reliable experience. Currently, Google is the supported authentication method. Users need a Google account to log in to apps that use Mocha's built-in auth. We're planning to add email/password authentication as an option in the future, which would allow users to sign up with any email address. If login works in your preview but not on your published app, see our [troubleshooting login guide](/guides/troubleshooting-login). This is usually related to third-party cookie settings in the browser. The preview environment is different from your published app. Login issues in preview due to cookies don't affect your published app. # Backend & APIs Source: https://docs.getmocha.com/basics/backend Mocha writes backend code for you, calls external APIs, and manages secrets Mocha is "full‑stack", which means you can build useful software, not just pretty mockups. Beyond the visual pages, Mocha can run logic for you in the background—things like saving form submissions, talking to other services (APIs), and powering features your business needs. Backend code runs in a scalable serverless runtime. It can handle a lot of traffic and scale up and down as needed. ## Quick start This section won't be long, because mostly Mocha just does the work for you. Say what you need in plain English. For example: “I want users to be able to subscribe to my app by giving their email address.” The AI will create the necessary backend logic. Don't give Mocha technical details like "use postgresql". This won't work well, Mocha is highly opinionated on how to build things technically, and you should describe your desired outcomes for the product, instead of the technical details. Use the in‑app preview to test the feature. You can see results and logs right away, then deploy when you’re ready. That's it! Congratulations on building a full-stack feature that uses your own backend code. ## Managing secrets Some features require private keys to talk to other services (often called "APIs"). These private keys are called secrets. Managing your secrets in the project settings A secret is a private value your app uses to connect to another service. It might be an API key, access token, or signing key. * Weather API key (for example, an OpenWeather key) to show today's forecast in your app * OpenAI API key to generate images or summaries for your content If your feature needs a secret, the AI will prompt you to add one and will wire it up correctly. You just provide the key once. Usually, Mocha will ask you to add a secret to your project as part of the conversation, and will even show you how to get the secret from the provider, just follow the prompts. Avoid pasting the secrets directly into the chat input. Instead, paste them into the secure forms that appear in the chat inyour pages or commit history. Store them as secrets instead. Adding a secret through the chat interface ## Common patterns Want weather data, maps, email, or payments? Save your API key as a secret and ask the AI to connect the service. Example: “Show today’s weather in San Francisco using my OpenWeather key.” Add forms to your pages to collect emails, feedback, or orders. The AI saves submissions and can store them in your database. Some services can notify your app when something happens (often called webhooks). Ask the AI to set this up and it will handle the details. *** ## Payments & Monetization Want to accept payments or sell products through your Mocha app? Here's what you need to know. Mocha doesn't have a built-in payment system. To accept payments, you'll need to integrate with an external payment provider like Stripe. Yes, it's possible to integrate Stripe with your Mocha app. However, we don't have an official step-by-step guide yet—this is an area we're still developing better support for. **Our recommendation:** Start simple. For most use cases, you don't need complex payment integration: * **Stripe Payment Links** - Create payment links in Stripe and add them as buttons on your site. No coding required. * **Stripe Checkout** - Redirect customers to Stripe's hosted checkout page for a more seamless experience. These simple approaches work for selling products, services, subscriptions, and donations without needing to build custom payment flows. No, Mocha doesn't have a built-in payment processor. You'll need to use an external service like Stripe or PayPal to accept payments. The good news is that these services are designed to be easy to integrate, especially if you use their hosted solutions like Payment Links. The simplest approach: 1. **Create a Stripe account** at stripe.com 2. **Create Payment Links** in Stripe for each product you want to sell 3. **Add buy buttons** to your Mocha app that link to your Stripe Payment Links This approach lets you start selling quickly without complex integration. Stripe handles the payment form, security, and receipts. Similar to Stripe, you can integrate PayPal by using their hosted checkout options and linking to them from your Mocha app. PayPal also offers simple button generators that work well for basic payment needs. Stripe supports recurring payments and subscriptions through their Payment Links feature. You can create subscription products in Stripe and link to them from your Mocha app. For more complex subscription management (like customer portals, usage tracking, etc.), you may need to build more custom integration. Starting simple with Payment Links is a great way to validate your business idea before investing time in more complex payment integrations. You can always upgrade to a more sophisticated setup later. # Custom Domains Source: https://docs.getmocha.com/basics/custom-domains Learn how to connect your own domain to your Mocha project