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).

Screenshot_2019-07-03_at_16.44.41.png

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 -->
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', 'XXXXXXXXXX');
fbq('track', 'PageView');
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=XXXXXXXXXX&ev=PageView&noscript=1"
/></noscript>
<!-- 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:

Screenshot_2019-07-05_at_15.39.13.png

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

Screenshot_2019-07-05_at_15.42.53.png

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:

Screenshot_2019-07-05_at_12.36.23.png

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.

Screenshot_2019-07-05_at_15.04.27.png

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

Screenshot_2019-07-05_at_15.10.47.png

Screenshot_2019-07-05_at_15.07.05.png

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:

Screenshot_2019-07-05_at_15.48.09.png

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:

Screenshot_2019-07-05_at_15.50.39.png

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:

Screenshot_2019-07-05_at_15.24.50.png

 

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

Powered by Zendesk