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

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:

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