How to Integrate with Google Analytics

Prefinery integrates with Google Analytics's new GA4 as well as the legacy Universal Analytics.

1. Add the Google Measurement ID

Since the Prefinery signup form - when installed on your website - is in an iframe like as shown below and self-hosted on our domain (prefinery.com) which is different from your website domain, you'll need to connect GA with your Prefinery project directly if you want to setup conversion tracking for your project in GA. 

To get started, get your GA property's measurement ID (if you're using Google Analytics 4) or tracking ID (if you're using Universal Analytics)

In your Prefinery project, click on Integrations and then on Google Analytics, and enter your unique Google Analytics UID in the field and click Save. Prefinery accepts either a GA4 Measurement ID (starts with G-) or a legacy Universal Analytics ID (starts with UA-).

At this point, depending on whether you're using the new Google Analytics 4 or are still using Universal Analytics, you have the following options for configuration: 

2.A Google Analytics 4 Configuration

Follow instructions to set up cross-domain measurement for your GA4 property: [GA4] Set up cross-domain measurement - At the minimum, it should have both prefinery.com and your website domain with Contains match type like as shown below. 

Google Analytics 4 Using gtag.js

There's no additional instructions or special setup you need to do on Prefinery's end for this. 

Google Analytics 4 Using Google Tag Manager

In your GTM Workspace, go to Triggers and click New to create a new trigger. 

Name the new trigger with something like Prefinery Events. Set Trigger Type to Custom Event, Event Name to ^prefinery and check the Use regex matching option. Finally, set This trigger fires on to All Custom Events. Save when done. 

Still in your GTM Workspace, navigate to Tags and click New to create a new tag.

Set a name for the new tag. Under Tag Configuration set Tag Type to Google Analytics: GA4 Configuration as well as your GA4 property's Measurement ID. Under Triggering set Firing Triggers to Prefinery Events or whatever event name you used in the trigger you created above. Save when done. 

Submit and publish your workspace changes when done. 

2.B Universal Analytics Configuration

Note: On July 1, 2023, Universal Analytics (UA) properties will stop collecting data. If you previously connected a UA property to your project, you should upgrade to a Google Analytics 4 (GA4) property.

In addition to adding your Google Analytics UID in Prefinery, you will need to make changes to the Google Analytics (or Google Tag Manager) configuration on your site. 

Universal Analytics Using analytics.js

Google's analytics.js library uses a unique client ID to determine whether a user is new or returning. To share this client ID across domains (i.e. between your domain and ours) you will need to modify your Google Analytics tracking snippet installation on your website and set the  allowLinker field to true when creating the tracker.

ga('create', 'UA-XXXX-Y', 'auto', {
  'allowLinker': true
});

For more information see Google's documentation on Measurement across multiple domains (analytics.js)

Universal Analytics Using gtag.js

Google's gtag.js library uses a unique client ID to determine whether a user is new or returning. To share this client ID across domains (i.e. between your domain and ours) you will need to modify your Google Analytics tracking snippet installation on your website as follows:

gtag('config', 'GA_MEASUREMENT_ID', {
  'linker': {
    'accept_incoming': true
  }
});

For more information see Google's documentation on how to Measure activity across domains (gtag.js).

Universal Analytics Using Google Tag Manager

You will need to make a change to your Google Analytics Settings Variable in order to configure cross domain tracking. For more information, see Google's documentation on how to Measure activity across domains in order to add the allowLinker field and the i.prefinery.com domain to the list of Auto Link Domains. The Google Analytics Settings Variable associated with your Google Analytics Universal Analytics Tag should end up looking similar to the following:

DIY Configuration

You can opt to ditch Prefinery's built-in Google Analytics integration and Do It Yourself. This will give you control over which events are sent to Google Analytics, and their properties. To do this, follow these steps:

  1. Click on Integrations and then on Google Analytics.
  2. Clear the value in the UID field, if it is set, and click Save.
  3. Click on Integrations and then on Code Injection.
  4. Copy your Google Analytics tracking code into the Head Code field and click Save.
  5. To send an event to your Google Analytics account when the Signup Form is viewed, click on Signup Form and then on the JS tab, and enter your code (wrapped in a script tag) into the Impression Tracking Code field and click Save.
  6. To send an event to your Google Analytics account when the Signup Form is submitted, click on Signup Form and then on the JS tab, and enter your code (wrapped in a script tag) into the Conversion Tracking Code field and click Save.

What events are sent to Google Analytics?

If you are using our built-in Google Analytics integration, and not the DIY approach as described above, then we will automatically send page views and events to your Google Analytics account as described below. The {{PROJECT NAME}} value is what you have named your project on the Settings > Project Settings page in your Prefinery account.

GA4

Signup Form

event name params
event prefinery_page_view page_title: {{PROJECT NAME}} Form
event prefinery_form_submission page_title: {{PROJECT NAME}} Form

Viral Referral Page

event name params
event prefinery_page_view page_title: {{PROJECT NAME}} Referral Page

Universal Analytics

Signup Form

page view /Prefinery/{{PROJECT NAME}}/ApplicationForm
event Prefinery » View » {{PROJECT NAME}} Application Form
event Prefinery » Submit » {{PROJECT NAME}} Application Form

Viral Referral Page

page view /Prefinery/{{PROJECT NAME}}/ViralInvitePage
event Prefinery » View » {{PROJECT NAME}} Viral Invite Page

Don't filter out events from our domain

As the events we send will come from our domain, prefinery.com, please ensure that your Google Analytics account is not filtering out events from domains other than your own.

Add our domain to the Referral Exclusion List

If you want to be able to measure a single session across multiple domains and prevent having your own domain show up as the referrer, you need to add the domains to the i.prefinery.com domain to the referral exclusion list following the guide below:

How to test your installation using Tag Assistant

Here's how you can verify that your tag installation is working:

1

Go to https://tagassistant.google.com/ and make sure you're logged in to the same Google account that you use in managing your GA/GTM account. 

2

Click on the Add Domain button. Enter the URL of the page where your Prefinery form is embedded at, and make sure the "Include debug signal in the URL" option is unchecked, then hit Connect

3

A new window will pop open displaying your page. This window is connected to the Tag Assistant app. Don't close it just yet. 

4

Back in the Tag Assistant browser tab/window, you'll find the tags found which you can select to view the data sent, depending on whether you're still using Universal Analytics (UA-...) or GA4 (G-...). At the minimum, you should have a prefinery_page_view hit for getting the form to display. 

5

Back in the form page window, make a test submission on your form. 

6

Back in the Tag Assistant browser tab/window, you'll also find a prefinery_form_submission hit this time, and another prefinery_page_view hit for the the referral page if you've set your form to display it on submit. 

Still need help? How can we help? How can we help?