What is the “fpdata” object, when and how to use it

This article is for developers with at least basic understanding of JavaScript

What is the “fpdata” object?

The fpdata object is similar to the dataLayer used by Google Tag Manager. It holds information about the visited page, latest actions taken by the visitor and accompanying data.

For example, when a visitor clicks something, you will find in the fpdata object information about the element that was clicked, information if it is a link or not, if it is a standard link or a hook to an element on the page, etc.

What can I use information from the “fpdata” for?

Information from the fpdata object can be used:

  1. In the custom scripts added with the “Custom Scripts” module.
  2. For writing triggering conditions in the “Advanced Triggers” module.

How can I access information from fpdata object?

To access information from fpdata object, simply open you browser’s console and enter “fpdata” in the “Console” tab.

fpdata in browser console

What information does fpdata hold?

The information that fpdata object holds changes depending on the situation. Below, I list the most common values.

activity

The “activity” property measures the time visitors are actively engaged with the page (in seconds).

Visitors are considered as actively engaged when these are true:

  1. The page is in focus – the browser window is in foreground and the tab with the page is on screen
  2. Visitor scrolled the page or clicked something in the last 15 seconds

The “activity” property has three values:

  1. current – tells you how much time visitors are spending on this page from the last moment the page got in focus
  2. last – the same as above but holds the value about the last time the page was in focus
  3. total – holds total time that the visitor was engaged with the page

For example, let’s think about this situation: someone opened the page, scrolled for 10 seconds and changed tabs, then they came back again and after 20 seconds of activity they stopped doing anything for 1 minute. After that, they closed the page.

The values for the “activity” property would then look like this:

  • current – 36 seconds (20 seconds of active engagement, 15 seconds countdown after last activity, plus 1 second to close the page)
  • last – 10 seconds
  • total – 46 seconds

adblock_enabled

Holds information if adblock is enabled on the current page

author_name

Display name of the author of the page

clicked

Holds information about the last clicked element on page and has these values:

  1. element – the full DOM element
  2. middle – whether the element was clicked with the middle mouse button
  3. link – the value shows only when the clicked element was a link or was wrapped with <a> element. This holds values:
    • element – the full DOM element
    • href – linked address
    • is_anchor – whether the link was an anchor pointing at a specific element on some page
    • is_outbound – whether the link pointed to a different domain
    • is_to_current_page – whether the link was an anchor pointing at a specific element on the same page
    • target_blank – whether the link was set to always open in a new tab

content_id

The ID of the current item in the WordPress Loop (see terms of taxonomies).

cookies

holds information on:

  • the cookies the visitor agreed to (it will also contain cookie information if the consent banner is in the “Only inform” mode!)
  • disabled – whether the current user disabled tracking for themselves using the magic link (see General Settings page > Tracking Exclusions section)
  • pp_pub – the date of the last update of the privacy policy
  • tools – list of tracking tools that can be enabled with received consents

country

2-letter country code of the visitor – available when the geolocation module is enabled. Depending on the geolocation service provider, this property can also contain other information about the location, e.g. currency, capital city, timezone, etc.

current_session

This property is available when visitors agree to statistical cookies from WP Full Picture.

It holds values:

  • landing_page
    • referrer – the address of the website that the visitor came from
    • url – the address of the first visited page
    • url_params – the URL parameters on the first visited page
  • lead_level – the lead scoring level that the visitor has reached this session
  • lead_score – the total amount of points the visitor collected this session
  • page_types – holds information on what types of pages a person visited during the session and how many times
  • page_views – the total number of pages viewed in a session – repeat views of the same page are counted (except refreshes).

A new session starts when the visitor is inactive for 30 minutes. When this happens, all values of this property are cleared.

doc_in_focus

Hold information if the page is currently being viewed

is_robot

The result of a bot check

new_session

Information if the currently displayed page is the first visited page in a new session.

Attention. The method of checking new sessions is different when people agree or decline cookies!

  • When people agree to statistical cookies, a new session starts when the WP FP’s session cookie is not available. This can happen when a person has visited the site for the first time or has not opened any new page within 30 minutes.
  • When people decline statistical cookies, the “new_session” value may be inaccurate. At the moment, there is no bulletproof method of checking for new sessions without cookies.

new_tab

Holds information if the currently viewed page has been opened in a new tab

Attention. Information whether a page is opened in a new tab is less accurate when people do not accept statistical cookies,

page_id

The ID of the page, post or any single post type (not a category or a tag)

page_title

Original title of the current page as entered on the page-edit screen.

published

date of publishing the page, post or any single post type (not a category or a tag)

recent_sessions

This property is available when visitors agree to statistical cookies from WP Full Picture.

It holds values:

  • sessions – the number of times a person visited the website. Increased every time the value of “new_session” property (see above) is true.
  • page_views – the total number of pages viewed in all sessions – repeat views of the same page are counted (except refreshes).
  • page_types – holds information on what types of pages a person visited during all their visits and how many times

Information on the recent sessions is stored in a cookie with 30 day expiry. If a person visits the site within 30 days from the last visit, the expiry will automatically prolong.

refreshed

Information whether the currently displayed page has been refreshed

region

This value is available when geolocation is enabled and provides information on the region of the visit.

scrolled

Holds information how deep was the page scrolled

Available values:

  • current – the current scroll depth – in percent
  • current_px – the current scroll depth – in pixels
  • max – the deepest measured scroll of this page – in percent
  • max – the deepest measured scroll of this page – in pixels

timezone

Visitor’s timzeone as determined by the JavaScript

user

Various information about the current user. The content of this property changes depending on whether the user is logged in and whether the site uses WooCommerce.

If a page uses WooCommerce, this property will hold information about their address, email address and other personal data. It will be available when a visitor is logged in and/or on the purcahse confirmation page.

woo

This property holds information about the products displayed on the page and added to the cart.

Custom metadata

If you use the “Custom metadata” module, you can add post, user and term metadata to the fpdata object. This provides great flexibility and lets you track values important to your business.