Google Analytics 4 is the next-generation measurement solution, and it has replaced Universal Analytics. On July 1, 2023, standard Universal Analytics properties stopped processing new hits. Analytics 360 will stop processing hits on 1 July 2024.
Our direct Google Analytics integration tracks page views by default. This means it will fire each time the page loads.
In order to connect your Google Analytics account with the landing page, follow the steps in this article: https://d.pr/OZrjvR. When you need to track more advanced metrics with Google Analytics, you will also have to customize and add their tracking script following the instruction below.
Please refer to this guide here: https://d.pr/reKeLb for event tracking with GA4.
Conversions will be triggered either by button clicks, or by form submissions, or by visits to a thank you page (used as a conversion page).
Note: You first have to connect the main Google Analytics integration as described in the article mentioned above.
1. Conversions triggered by button clicks
You can easily add Google Analytics events that fire upon button clicks using the code snippet below. Paste the code into Settings - Javascript - Body:
For any Google Analytics event, you will need to customize the event parameters. You will need to replace the square brackets with your event fields. Note that the fields [Category] and [Action] are required. The rest of the fields are optional: if you configured them in Google Analytics, replace the brackets with their names; if you are not using them, delete the corresponding brackets from the code.
Please consult Google’s documentation for more information about how to configure your Google Analytics events here: https://d.pr/iBX89T.
You will also have to change the element ID number with the one of your own button. Here is how you can find the button element ID number:
If you want to track multiple buttons, you will have to add the code again for each button. Don’t forget to customize all the individual code snippets to have the correct element ID number and event parameters for each separate button.
2. Conversions triggered by form submissions
While you can check the form submissions on our built-in Analytics dashboard, you can also set up a Google Analytics event to track them.
Note that we offer two different code snippets for when you want to fire the same Google Analytics event for all your page forms or for when you want to fire a different Google Analytics event for each form on your page.
If you want to track one form, you need to paste the following snippet into Settings - Javascript - Body:
Just like with event fired on button clicks, be sure to customize the event parameters as per Google’s documentation here: https://d.pr/6w1ajz.
If you have multiple forms on the same page, please use the snippet below. This needs to be pasted into Settings - Javascript - Body:
For this second code snippet, you will need to edit the "wid" value, which is only the digit part of the element ID. For #element-659, the "wid" value is "659".
3. Conversions triggered on the thank you page
You can also track conversions with a thank you page. First, create and publish a thank you page, and then set your main landing page to redirect to the thank you page after form submission, as shown here: https://d.pr/H4HkLO. In this case, both pages should have the Google Analytics ID added in Settings> Analytics, and the thank you page should contain this code snippet as well in Settings - JavaScript - Body:
Note: Google Analytics needs 24 hours to process the data received.
Note: Tracking conversions on the 'Thank You' page with GA is not recommended because:
1. Anyone can reload the 'Thank You' page, and it will lead to inflated conversions;
2. Source tracking for the 'Thank You' page visit might not be reliable. When the same 'Thank You' page is set for multiple pages, it is difficult to differentiate the data for each page in terms of where the visit came from (for example: a visitor comes from page A and lands on the 'Thank You' page, but all the events on the 'Thank You' page trigger - Page A, Page B, Page C, etc). With advanced Google Analytics filters and UTM parameters in the URL, this can be improved to be more readable and relevant.
We suggest only tracking 'Thank You' page visits if the other two options from above (form submissions & button clicks) are not viable for your use case.
How to track the same action on multiple platforms at the same time
If you need to track conversions using events from both Facebook(https://d.pr/K56sJw) and Google Analytics(https://d.pr/hoi7AN) or Google Ads(https://d.pr/mKU0dz), you just need to add the code for that platform in the same function, instead of copying the entire code again. This is because the function only needs to be triggered once. If you use the same code with the same function twice, the second function will override the first one. You can find the content of the respective functions in the dedicated articles for conversion tracking for the other platforms linked above.
1. For form submissions
2. For button clicks
NOTE: We only offer the ability to add custom code. We do not provide custom code assistance through the support team. In case you need help with a custom functionality or any code customization that is not provided through our Help Center articles we have a Professional Services team that can help our Convert users. The Convert plan includes Professional Services as well as additional features and services that can be seen here: https://instapage.com/convert-benefits
Attributing conversions to different variations if you are A/B testing your page
If you are A/B testing your page and you want to attribute the conversions tracked with events to a certain variation, you will need to send the data to the dimension that represents that variation.
To do that, the following code needs to be added right above the standard form or button conversion tracking:
var variantName = __variant_custom_name;
This will identify the variation name from the visitor's browser, so they can attribute their conversions to that variation. Next, you will need to add another object in the event snippet:
{dimension1: variantName}
For example, here is what an event snippet will look like after you add that:
ga('IPTracker.send', 'event', 'form', 'submit', {dimension1: variantName});
NOTE: You will need to change dimension1 to dimension2, dimension3, etc, depending on the index number of the GA dimension that represents the variation in question. This can be checked in the GA account in Admin >> Property Settings >> Custom Definitions >> Custom Dimensions (Screenshot: https://d.pr/i/bwQDSZ ).
If needed, you can also refer to Google Analytics’ documentation on custom dimensions: https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets