Connecting a landing page hosted elsewhere
Your landing page lives on your own hosting, Qubix has no access to its server, and you want its visits, clicks, forms and events in Qubix together with everything else. Such a landing page is connected with code that runs in the visitor's browser: the page stays on your server, and the browser reports to Qubix what happens on it. One code serves the landing page whatever sources buy traffic for it.
If the landing page is uploaded to Qubix, nothing has to be added to it — see Hosting a landing page in Qubix.
How to connect the landing page
- Open the Landing pages section and click + Site externe.
- Enter the landing page's name and its address, for example
https://my-landing.com. Leave Suivre les événements on; turn on Enregistrer les sessions if you also want session recordings. Click Créer. - Open the landing page card. On the Site externe tab, find the Connecter le site block.
- In the Domaine Qubix list, pick the domain the code will load from. It is one of the domains of the Domains section, not the panel address. If the list is empty, add a domain first.
- Put the code on every page of the landing page in one of the two ways below and publish the pages.
The address of the landing page is shown in the card and in the list of landing pages. A person whose permissions do not open the address sees Hidden by your permissions in its place.
If both Suivre les événements and Enregistrer les sessions are off for the landing page, the block shows no code — a message instead and, with the right to manage landing pages, the Suivre les événements switch right in the block. A switch you turn on takes effect within a minute.
Way 1: a script from the Qubix domain
Copy the Script depuis le domaine Qubix block and paste it into the <head> of every page. The code looks like this:
<script src="https://your-qubix-domain.com/sdk.js" data-site="WEBSITE-ID" async></script>
The data-site attribute carries the identifier of this landing page, so the code names the landing page itself. With Enregistrer les sessions on, the block has a second line — the session recording script.
The page sends visits and events straight to the Qubix domain, and the visitor's identifier is kept on your landing page's domain — in the browser storage and in the piuid cookie, so your landing page's server sees it too. This way works while Suivre les événements or Enregistrer les sessions is on for this landing page or for any other external landing page on the same domain: the permission belongs to the domain. Without it Qubix does not accept the page's events. http and https, as well as an address with www. and without it, count here as different domains.
Way 2: through your nginx
The Via votre nginx block holds two location blocks and the script. Add the blocks to the server section of your landing page and the script to the <head> of every page:
location /pwa-api/ {
proxy_pass https://your-qubix-domain.com/pwa-api/;
proxy_set_header Host your-qubix-domain.com;
proxy_ssl_server_name on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
set $qubix_visitor_ip $remote_addr;
if ($http_cf_connecting_ip) { set $qubix_visitor_ip $http_cf_connecting_ip; }
proxy_set_header X-Qubix-Visitor-IP $qubix_visitor_ip;
}
location = /sdk.js {
proxy_pass https://your-qubix-domain.com/sdk.js;
proxy_set_header Host your-qubix-domain.com;
proxy_ssl_server_name on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
<script src="/sdk.js" data-site="WEBSITE-ID" async></script>
The /pwa-api/ and /sdk.js addresses of your landing page now lead to Qubix, and the browser sees one site: the visitor's identifier is a cookie of your landing page's domain. Events that come through your server are accepted whatever the switches say.
The last three lines of the first block pass Qubix the visitor's IP address — from Cloudflare when your landing page stands behind it. Qubix determines the visitor's country from this address. Without these lines every visitor gets the address and the country of your server. Qubix takes the address from this header as it arrives and does not check who set it.
What the code counts
The code counts by itself, with no calls of yours:
- the visit — when a page is opened not from another page of the same landing page: from an ad, by a link from elsewhere or by typing the address. The ad is taken from the
ad_idparameter of the address; - the following pages of the same landing page continue that visit and do not count new ones;
- clicks and forms — on every page.
If the page is opened by a link that names the visitor — for example, an offer link that passes the click identifier in a parameter of your choice, sub1={subid} or clickid={subid} — and the page keeps no identifier yet, the code sends the parameters of the page address with the visit. While Suivre les événements or Enregistrer les sessions is on for the landing page's domain, Qubix looks among their values for a visitor it already knows — by their click or visit — and takes the first one in the order of the address, so the visit continues the visitor's path; values Qubix does not know are skipped, and with none known the visitor gets a new identifier. An identifier the page already keeps stays, whatever the address says.
Registrations and deposits arrive as the network's postback, as usual. When they happen on your landing page, the page reports them itself — sdk.sendEvent('reg') or sdk.sendEvent('dep', …), see Report a registration or a deposit — or your landing page's backend sends them, see If your landing page has its own backend. Your own steps on the page are marked with sdk.sendEvent — see Mark up your own steps.
The numbers are in the landing page card, in the Synthèse, Répartitions, Journaux, and Autre groups of its sidebar — see Your landing's statistics.
If your landing page has its own backend
Your backend — in PHP or anything else — can send registrations and deposits to Qubix itself, without the browser: with a request to the postback address, the same way an affiliate network does.
- Take the postback address in the card of a domain with the Postback role — see Domain settings. The address carries the code of your installation; it is shown only to those who see all domains.
- Take the visitor identifier from the
piuidcookie of your landing page's domain: the browser sends it with the application, whichever way the landing page is connected. With the script from a Qubix domain the cookie appears once Qubix has answered the page's first event. The page can also hand the identifier over itself: take it from the tracking code —sdk.getPiuid()— when the application is sent, and pass it to your backend together with the application, for example in a hidden form field. - When the backend has accepted a registration or a deposit, it calls the postback address with that identifier:
# registration
curl "https://pb.your-domain.com/<code>/postback?subid=CLICK_ID&status=lead&from=mysite"
# deposit
curl "https://pb.your-domain.com/<code>/postback?subid=CLICK_ID&status=sale&payout=50¤cy=USD&from=mysite"
The conversion lands on its click, campaign and ad. All the parameters and their synonyms are in Parameter passing and postback.
Which campaign a visit belongs to
A visit belongs to the tracker campaign whose entry point covers the address of the page — its domain and path. If several campaigns stand on that entry point, the click picks one of them by the same rules as on a landing page hosted in Qubix — see One landing, several sources. The entry points of a campaign are picked from the domains of the Domains section.
An entry point with a path on the landing page's domain — /demo, for example — can lead the visitor on by itself, with no page: your server forwards this path to Qubix, as it forwards /pwa-api/, and Qubix records the visit and sends the person on. Such a path is served only by a target that sends the visitor further — Redirection vers une URL or Redirection vers l'offre; with any other target, and on the domain without a path, Qubix shows nothing there.
If no campaign has an entry point on the page's address, visits and events are still counted for the landing page, but they belong to no campaign. Where a conversion goes is decided by the traffic source Qubix attributes the click to. Usually that is the source of the visit's campaign, so the conversions of such visits are not sent on. The exception is a platform whose campaigns are attached to tracker campaigns: for it, the source of the attached campaign decides — see The path of a visitor and a conversion.