Using GTM DataLayer For FigPii

As mentioned in Event tracking on FigPii guide, FigPii has its own dataLayer called _fpEvent. If you wish to continue using GTM / GA's dataLayer to track events in FigPii you can follow this guide to sync your dataLayer with FigPii's _fpEvent.

Note: At the moment this is only possible using Google Tag Manager, please contact support if you're using GA events but don't have GTM installed on your site

Integrating GTM's dataLayer with FigPii

Pushing dataLayer events to FigPii is a 3 step process:

  1. Creating Data Layer Capture Trigger in GTM

    This will trigger a sync between FigPii's _fpEvent and Data Layer on every dataLayer.push().
  2. Creating the Sync Tag in GTM

    Tags are code snippets that finally push the data captured by the triggers to FigPii.
  3. Defining event based goals in FigPii

    Once you’ve configured GTM, the next step is to define your events in FigPii.

Creating Data Layer Capture trigger in GTM

Info: Integrating your GTM dataLayer with FigPii's _fpEvent is a one-time setup. You don't need to repeat this procedure for every new FigPii experiment.

Simply put, this will trigger a function that syncs up _fpEvent with dataLayer after every push.

Create a trigger for the FigPii Data Layer Capture by configuring the following fields:

1. Switch to the Trigger view and click on New in your GTM dashboard.

2. In the Trigger Name field, enter  FigPii Data Layer Capture.
3. Click on the Trigger Type, and select  Custom Event.
4. In the Event Name field, enter .*
5. Turn on Use regex matching.

6. Click Save.

Creating Data Layer Capture Tag in GTM

Create a Tag for the FigPii Data Layer Capture trigger by configuring the following fields:
1. Switch to the Tag view and click on New in your GTM dashboard.

2. In the Tag Name field, enter FigPii Data Layer Capture Tag.
3. Click on Tag Configuration and select Custom HTML.
4. Paste the following code in the HTML field:
<script>!function(){window._fpEvent=window._fpEvent||[];for(var e=window._fpEventLastProcessedDataLayerIndex||0,n=window.dataLayer||[],t=window._fpEvent||[],v=e;v<n.length;v++){var a=n[v];a.length?"event"!==a[0]||JSON.stringify(t).includes('"value":"'+a[1]+'"')||a[1].includes("gtm.")||window._fpEvent.push(["eventConversion",{value:a[1]}]):!a.event||JSON.stringify(t).includes('"value":"'+a.event+'"')||a.event.includes("gtm.")||window._fpEvent.push(["eventConversion",{value:a.event}]),window._fpEventLastProcessedDataLayerIndex=v}}();</script>
5. Click on the Triggering field and select  FigPii Data Layer Capture.
6. Click on Save.

Defining event based goals in FigPii

Follow this guide to define your dataLayer based events in FigPii. Defining Site Goals

Still need help? Contact Us Contact Us