Proxying Proxima through Vercel

If you're considering an alternative to Vercel Analytics, we've got you covered. Take a look at our detailed comparison against Vercel Analytics to find out more.

Vercel is a cloud platform for static sites and Serverless Functions that allows developers to build, deploy, and scale modern web applications and websites. Vercel's platform is designed to be fast, reliable, and easy to use, making it a popular choice for developers looking to create and host web applications and websites.

Vercel Rewrites is a feature of Vercel that allows developers to create custom rules for how incoming requests to their application or website are handled. With Rewrites, developers can define patterns that match specific routes and redirect them to a different destination, or serve different content based on the incoming request. This can be useful for creating custom routing logic, handling traffic redirection, or modifying the content of a response based on the request.

You can use Vercel Rewrites to proxy calls to the Proxima tracking API. Here's how to get started:

  1. Create a special `vercel.json` file in the root of your application.
  2. Define the Rewrite rules that redirect calls within your application to the Proxima tracking API:
{
  "rewrites": [
    {
      "source": "/example/js/script.js",
      "destination": "https://buzz.proxima.so/script.js"
    },
    {
      "source": "/example/torch",
      "destination": "https://buzz.proxima.so/torch"
    },
    {
      "source": "/example/pixel",
      "destination": "https://buzz.proxima.so/pixel"
    }
  ]
}
  1. Add the Proxima tracking script tag to your application's HTML page, passing the rewrite configured in the `vercel.json` file:
<script defer src="/example/js/script.js" data-site="XXXXXX"></script>

Integrating Proxima Analytics into your Vercel application or website is simple and straightforward with Vercel Rewrites. You can learn more about Vercel Rewrites in the Vercel documentation.