Use virtual pageviews with Facebook Pixel code

Tabata Vossen -

Several of our users mentioned an important issue: it was impossible for them to create Facebook custom audiences based on pageviews (URLs) of a campaign. In this article, we'll show you how to track (virtual) pageviews with Facebook Pixel in Qualifio campaigns.

So what's the problem?

Let's say you'd like to launch and ad campaign and show it only to participants who did not complete your survey to the exit screen. Unfortunately, this is not possible with the default Pixel, as the pageviews of a Qualifio campaign do not appear in the Facebook Pixel data.

Looking for a solution

Here's the plan: every time a participant switches from one campaign step to another (welcome screen, questionnaire, form, exit screen), we'll send a custom event to Facebook with a Virtual URL as an additional parameter.

Step 1: Get Facebook Pixel

In Facebook Ads Manger, click the menu icon in the top left corner and choose Pixels (under Measure & ReportEvents Manager).


Click Details, then Set Up > Install PixelManually Install Pixel Code Yourself. You'll get a piece of code like this one (except the XXXXXXXXXX part which contains your unique Pixel ID):

<!-- Facebook Pixel Code -->
s.parentNode.insertBefore(t,s)}(window, document,'script',
fbq('init', 'XXXXXXXXXX');
fbq('track', 'PageView');
<noscript><img height="1" width="1" style="display:none"
<!-- End Facebook Pixel Code -->

Step 2: Setting up your virtual page views in your campaign

In Qualifio Manager, you'll need to go to your campaign and add this code in two different spots:

  • First spot: under ChannelsTags > Additional HTML code.
  • Second spot: in the first step of your campaign, which is your welcome screen if you have one, or the Optional introduction text above your questionnaire (Questions step).

In the first spot only (Channels step), you'll need to twist this piece of code in the following way:

  • Find the fbq('track', 'PageView'); function.
  • Replace it with the following one:
fbq('trackCustom', 'VirtualPageView', {url: qlfDataLayer[0].page_path})
  • Hit Save.

Step 3: Double check your setup

What you should see in your campaign Tags:


What you should see in your welcome screen or your questionnaire's optional introduction text:


Step 4: Check the data

Rule of thumb: always check whether data was correctly sent to Facebook. The best option to do so is to use the Chrome extension Facebook Pixel Helper. Whenever a tag is fired, a green notification will appear on its icon. Click it and you'll see what data was sent to Facebook. A green check mark next to the event indicates that data was sent successfully. See the screenshot below:


Now, go to Facebook and open Facebook Pixel data reports. Your events usually appear there approximately 30 minutes (or sooner) after the data was sent to Facebook.


In the Events section of your Facebook Analytics, you will see a new event appeared there: VirtualPageView.



Final step: Create a Custom Audience

Facebook offers a wide range of targeting options. For instance, let's keep the example where you'd want to create remarketing campaigns for people who have engaged with your campaign but didn't complete their participation to the exit screen.

To do so, you can simply go to the Audience Manager and create a Custom Audience based on past website traffic:


You can choose between multiple options, but in this case you'll want to target people based on your events, and more specifically based on the VirtualPageView event:


Narrow down your audience

Unless you want to target all the people who engaged with your campaign, no matter the steps or pages they've seen, you'll need to narrow your audience with additional targeting options.

To do so, select Refine by URL/Parameter and enter the combination you want. In this example, you'd want to target people who did not visit your exit step.

Specific steps are referred to and can be targeted using the following:

  • Welcome screen = "intro"
  • Questionnaire = "questionset"
  • Form = "identityset"
  • Exit screen = "exit"

Hence the "URL doesn't contain exit" for this example:



In case you'd like to do some additional reading on Facebook retargeting, check out this guide: 

Can’t find the answer you need?

Send us a question and connect with an expert to get personal assistance.

Contact support

Vous ne trouvez pas les réponses que vous cherchez ?

Nous sommes là pour vous aider. Envoyez-nous une demande en direct !

Contacter le support
helpcenter experts