Documentation        Log in

Rule Based/Page Depth


PREVIOUS

Chapter 2 – Scroll Depth


NEXT

Chapter 4 – Time on Site (Coming Soon)

Intro

Page depth measures how many pages a visitor viewed in a single session. It’s a very powerful and simple metric that helps  understand intent.

How To Setup

This short guide will help you set up the trigger. If you’d like a shortcut, we’ve created a simple tool that will prepare a downloadable Google Tag Manager container -> Click here

1

Setup a Page Depth Tag in Google Tag Manager

Open GTM and go to the Tags screen

Click on NEW

Give your Tag a name – “Page Depth” for example

In Tag configuration, select Custom HTML

Paste the following code:

<script>
sessionStorage.pageview_counter = parseInt(sessionStorage.pageview_counter || 0) + 1;
if(sessionStorage.pageview_counter > 0 && sessionStorage.pageview_counter<11)
{dataLayer.push({‘event’: ‘pageDepth’, ‘pageDepth’:sessionStorage.pageview_counter});}
</script>

In Triggers, select All Pages

Click ‘Save’.

2

Create a Page Depth Data Layer Variable

Go to the Variables screen

Under ‘User-Defined Variables’ Click on NEW

In variable type, select: “Data Layer Variable

Name the Variable ‘DLV pageDepth’

In ‘Data Layer Variable Name ‘ enter:
pageDepth

Click ‘Save’.

3

Create a Tag to fire Page Depth to Facebook

Go to GTM Click on Tags

Click on NEW

Give your Tag a name, for example “Page Depth to Facebook”

In Tag configuration select Custom HTML

Paste this code into the tag:
<script>  fbq(‘trackCustom’, ‘time on page {{DLV pageDepth}} pages viewed’) </script>

Click on Triggering

Select Custom event

Enter:
pageDepth

 

Click on Save

4

Create a Tag to fire Page Depth to Google Analytics

Go to GTM Click on Tags

Click on NEW

Give your Tag a name, “Google Analytics Time on Page”

In Tag configuration select Google Analytics

In Track Type select, “Event”.

In Category enter “event”

In Label enter “Page Depth”

In Label value enter {{DLV pageDepth}}

In Google Analytics Settings, Use your Google Analytics Settings Variable. If you don’t have one, simply click on Create Variable and enter your Google Analytics ID.

Click on Triggering

Select Custom event

Enter:
pageDepth

Click on Save

Downloadable GTM container

Here’s your shortcut to glory!

Ready made GTM container fully set up with tags for Google Analytics and Facebook. You can easily customize the settings such as the timer’s interval and limit.

Just download this GTM import file below, unzip it, and follow the instructions.

Log into your GTM account

Choose to the Account and Container in which you want to install Fixel

Navigate to the Admin section

Choose ‘Import Container’

Click ‘Choose container file’ and select the JSON file downloaded

Select the ‘Existing’ workspace option

Change the radio button to ‘Merge’

This is very important so that all your existing configuration carries over to the merged container.

Keep the ‘Overwrite conflicting tags, triggers and variables’ selection

Click ‘Confirm’

Publish the container by clicking ‘Submit’ on the workspace’s main screen