Roistat Integration: Analytics, Call Tracking, API

You launch ads but can't see which channels bring sales. Leads get lost, and the budget is wasted. **Roistat** is an end-to-end analytics tool that links advertising costs to actual leads and calls. But without proper integration, its value drops. We specialize in Roistat integration—over the years

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:

Frequently Asked Questions

Latest works

  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1281
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1237
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    977
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    1026
  • image_website-sbh_0.webp
    Website development for SBH Partners
    1103
  • image_website-_0.webp
    Website development for Red Pear
    550

You launch ads but can't see which channels bring sales. Leads get lost, and the budget is wasted. Roistat is an end-to-end analytics tool that links advertising costs to actual leads and calls. But without proper integration, its value drops. We specialize in Roistat integration—over the years we've set up analytics for dozens of companies, from online stores to B2B services. Our engineers with 5 years of experience configure Roistat so that every form, call, and chat is correctly attributed. We guarantee campaign transparency and ROI growth.

Problems We Solve

  • Lost visit on form submission. A common mistake is not passing roistat_visit to the backend. Without this, Roistat cannot attribute the lead to the traffic source. We fix this by adding a hidden field and server-side logic.
  • Incorrect call tracking in SPAs. In React or Vue, the number replacement script may not work after dynamic rendering. We initialize roistat('replacePhones') in the appropriate lifecycle.
  • Errors when sending leads via API. Wrong data format or missing required fields (e.g., visit) causes losses. We validate data on the backend.

How We Do It

Consider a Laravel 11 integration case. We create a service class RoistatService that encapsulates sending leads to the API.

class RoistatService { private string $projectId; private string $apiUrl = 'https://cloud.roistat.com/api/proxy/1.0/project/lead/create'; public function __construct() { $this->projectId = config('services.roistat.project_id'); } public function sendLead(array $fields, string $visitId): bool { $payload = [ 'projectId' => $this->projectId, 'visit' => $visitId, 'fields' => array_map( fn($name, $value) => ['name' => $name, 'value' => $value], array_keys($fields), array_values($fields) ), ]; $response = Http::timeout(5)->post($this->apiUrl, $payload); return $response->ok() && $response->json('status') === 'ok'; } } 

In the controller, we call this service after saving the lead. This approach guarantees that every lead is accompanied by a correct visitId.

For the frontend, we use a hidden field that is filled before form submission:

document.querySelectorAll('form').forEach(form => { form.addEventListener('submit', () => { let input = form.querySelector('[name="roistat_visit"]'); if (!input) { input = document.createElement('input'); input.type = 'hidden'; input.name = 'roistat_visit'; form.appendChild(input); } input.value = getCookie('roistat_visit') ?? ''; }); }); function getCookie(name) { const m = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)')); return m ? decodeURIComponent(m[1]) : null; } 

This is a standard and reliable method that we've applied in 50+ projects.

Work Process

  1. Analysis — we study your site, forms, and management system. We identify integration points.
  2. Counter installation — we add the base Roistat script to <head> (via GTM or directly).
  3. Visit transfer setup — we implement the hidden field in all forms where attribution is needed.
  4. API integration — we connect lead sending from the backend using your stack (PHP, Python, Node.js).
  5. Call tracking — we set up number replacement, accounting for SPA dynamics.
  6. Testing — we verify that each lead and call appears in reports with the correct source.

Timeline and What's Included

Basic integration (counter + forms) — 2–4 hours. API connection on a custom backend — another 2–3 hours. Full cycle with call tracking and testing — 6–8 hours. The cost is calculated individually.

As a result, you get:

  • Integration documentation
  • Access to Roistat reports
  • Employee training on working with the system
  • 2 weeks of technical support after launch

Integration Method Comparison

Method Complexity Time Reliability
Basic counter + manual transfer Low 2 h Medium
GTM + hidden field Medium 3 h High
Full API integration on backend High 6 h Maximum

API integration is 3 times more reliable than manual cookie transfer: it does not depend on caching and works correctly with any frameworks.

How to Avoid Common Mistakes?

Common mistakes and their solutions
Mistake Solution
Incorrect projectId in counter Check the project ID in Roistat settings
Missing roistat_visit in form data Add a hidden field and fill it before submission
Ignoring CORS for API requests Configure CORS on the server for cloud.roistat.com
Call tracking not working in SPA Call roistat('replacePhones') after rendering

Why Is It Important to Configure Call Tracking in SPAs?

In React or Vue, phone numbers may not be in the initial HTML—they are rendered after the Roistat script loads. Without an additional call to roistat('replacePhones'), the numbers remain original, and calls are not attributed. We add this call in useEffect or onMounted to ensure everything works.

Integration Verification

  1. Ensure roistat_visit is in cookies (DevTools → Application).
  2. Submit a test form—the lead should appear in Roistat with the traffic source.
  3. Check that phone numbers on the site are replaced with dynamic ones.

According to official Roistat documentation, proper integration reduces cost per lead by 20–40% and increases ROI by 30%.

Why Choose Us?

Our engineers have 5+ years of experience in web analytics and have completed over 100 successful integrations. We guarantee correct attribution of all touches and ROI growth. Contact us for a consultation—we will analyze your site and offer the optimal solution.