Tracking Success Page Views

How to add CAPI Facebook Tracking your Thank You Page using GTM and Deviate Tracking

Overview

This walkthrough will help you implement and troubleshoot your CAPI Facebook tracking on your website’s Thank You page(s) using Deviate Tracking and Google Tag Manager. The setup is as simple as your usual Trigger & Tag setup with Deviate Tracking’s Facebook CAPI Tag template.

Prerequisites

Make sure GTM is installed

Before anything, make sure you have Google Tag Manager (GTM) installed. You can find out how to install GTM or if it’s installed already here.

Setup Deviate Tracking Variables

It’s best practice to configure your Deviate Tracking Variables beforehand, it’ll also save a lot of time in the long run by removing a redundant task that can cause mistakes easily when overlooked. If you haven’t yet, <set up your Deviate Tracking Variables>.

Creating a trigger

Firstly, create a Trigger in GTM so that our Deviate Tracking tag fires accordingly on your site. Head over to your Workspace in GTM and find the Triggers in the left-hand side menu. Click ‘New’ to start configuring your Trigger.

CAPI Facebook Tracking (6)

[Image of ‘New’ button in the Trigger section of Workspace]

Next, click the empty Trigger Configuration box and in the Choose Trigger Type menu options, select Page View Trigger Type and choose Some Page Views. This essentially tells GTM to only fire our Deviate Tracking tag on the specified Thank You pages that we’ll configure in the next step.

Choose Built in Variable

Choosing the Some Page Views option will bring up a field of conditions to be set. Click the first dropdown “Page Hostname,” and select Built in Variable. Choose Page Path. Next, Grab the URL of the ‘Thank You’ page on your website and copy the URL Path specifying that it’s the Thank You page. For example, If users are redirected to https://www.mycompany.com/form/thankyou.html after submitting a form, ideally you will set that this [Page Path] must [Contain] [/thankyou.html].

It’s common practice to be as specific as possible when defining the Page Path condition, so that you know which Thank You page belongs to which form or conversion event. Lastly, before finishing your Trigger setup, name it accordingly —

For example: [Trigger Type] – [What the Trigger does].
Page Path – /thankyou.html
Page Path – Thank you page (form submission)

CAPI Facebook Tracking (8)

[Image of the Trigger configuration to fire on Thank You pages]

Creating the Tag

After configuring the trigger, the next step is to create the Tag using Deviate Tracking’s Tag template found in the Community Template Gallery. Navigate to your Workspace’s left-hand side menu, and go to Tags. Select ‘New’ and click the empty Tag Configuration box. Click the blue bar to open the Community Template Gallery and search for Facebook Conversions API (CAPI) by DeviateLabs. Click Add to Workspace or Choose Template depending on if you’ve already added the Template or not. Now, the Tag just needs to be configured.

CAPI Facebook Tracking (5)

[Image of the searching for Deviate Tracking in the Community Template Gallery]

Deviate Tracking Settings

Set the four Built in Variables that have already been pre-configured; Deviate Tracking Email, Deviate Tracking Key, Facebook Token, Facebook Pixel ID.

Set standard event type to whatever your ad is being optimized for:

Set your Event Type to select which event you’d like to track or optimize for. Some common examples include:

  • Event Type is set to CompleteRegistration for sign ups
  • Event type is set to Purchase for a purchase conversion
  • Event type is set to Schedule for a booking appointment conversion
  • Event type is set to Lead for an opt in form thank you confirmation

Set the trigger to the one that was made

In the Triggering section below, click and choose the Trigger that was just configured to fire on your Thank You pages.

CAPI Facebook Tracking (3)

[Image of configuring the Tag for Deviate Tracking using the Built-in Variables and CAPI from the Community Template Gallery]]

Test and then publish

Before publishing your Container and pushing out your new Version, test that the Tag is firing accordingly on the correct pages using Preview Mode in GTM.

Tips:

Here are some tips when using Triggers and Tags in GTM to track conversions through ‘Thank You’ pages.

Preventing double firing

To prevent double firing of Tags, check your referrer page by adding a Built In Variable inside your Trigger and configure the Built In Variable to the webpage that the user visits before landing on the Thank You page.

CAPI Facebook Tracking (1)

[Image of adding the Referrer Built In Variable and configuring it to the page visited before landing on the Thank You page]

In your Tag configuration settings, where you chose Deviate Tracking’s Facebook CAPI and the 4 built-in variables, choose Advanced Settings > Tag Firing Options > select Once Per Page

CAPI Facebook Tracking (7)

[Image of selecting the Tag to fire One Per Page within the Deviate Tracking Tag Configuration]

Additionally, you can also use UTM parameters to confirm the traffic source. Within Deviate Tracking’s Trigger Configuration, add a second Built In Variable and select the Page URL option. Select Contain in the next dropdown, so that the condition states that the Page URL must Contain. Lastly, add a query parameter, such as the Order ID, that exists in the Page URL before landing on the Thank You page.

CAPI Facebook Tracking (4)

[Image of adding a query parameter condition to the Trigger configuration]

Make sure Deviate Tracking PageView tag is also installed and has fired on the same page

Double check that your Tag that was just configured for Deviate Tracking is installed into your Container and is firing on the same page. Here’s a quickstart tutorial to walk you through this.

Test in Preview Mode (GTM)

Always test in Preview Mode before publishing and to check if your Triggers and Tags are firing properly on the correct pages. Most debugging can be resolved in Preview Mode inside GTM. Here’s a tutorial to walk you through Preview Mode in Google Tag Manager.

Use Test events mode in facebook events manager

Alternatively, you can test events using the Test Events Tool in Facebook’s Events Manager if you have the Facebook Pixel installed. Please note: Make sure that test mode is off in your production environment. To do this, head over to your Deviate Tracking Tag configuration and under the ‘User Data Parameters’ is a checkbox asking to ‘Send as a Test Event?’ Ensure that this is unchecked when you are tracking real data. This option should only be enabled when you’re using Preview mode in GTM.

CAPI Facebook Tracking (2)

[Image of disabling Test Mode in Deviate Tracking Tag inside of GTM]

Leave a comment