Welcome to the Instapage Support Center

|

Google Analytics Event tracking with the advanced integration

Google_Analytics_Logo_2015.png

Note: The Google Analytics advanced integration is only available for Enterprise users.

Our direct Google Analytics integration is tracking by default page views. This means it will fire each time the page loads. In order to connect your Google Analytics account with the landing page please follow the steps in this article.

When you need more advanced metrics tracked with Google Analytics, you will also have to customize and add their tracking script following the instruction below.

Conversions will be triggered either by button clicks, by form submissions, or by visits to a thank you page.

Note: before you implement custom Google Analytics events, be sure to integrate your page with Google Analytics as described in the article mentioned above.

Events for button clicks

You can easily add Google Analytics events that fire upon a button click using the code snippet below (pasted into Settings > Javascript > Header):

<script>
ijQuery(document).ready(function(){
ijQuery('#element-123 a').on('click', function() {
ga('IPTracker.send, 'event', [Category], [Action], [Label], [Value], [fieldsObject]);
});
});
</script>

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. Please consult Google’s documentation for more information about how to configure your Google Analytics events.

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:

button_gif.gif

 

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.

Form submission events

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.

The following snippet can be used for when you want to fire the same Google Analytics event for all the forms on your page (pasted into Settings > Javascript > Header):

<script type="text/javascript">
window.instapageFormSubmitSuccess = function( form ){
ga('IPTracker.send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);
};
</script>

Just like with event fired on button clicks, be sure to customize the event parameters as per Google’s documentation.

The following snippet can be used for when you want to fire different Google Analytics events for the forms on your page (pasted into Settings > Javascript > Header):

<script>
window.instapageFormSubmitSuccess = function( form, wid ){
if ( wid === 6 )
{
ga('IPTracker.send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);
}
else if ( wid === 7 )
{
ga('IPTracker.send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);
}
else
{
// do nothing out of a box
}
};
</script>


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".
ezgif-4-c5fb71d795d3.gif

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. 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> in the Header Section:

<script>
ga('IPTracker.send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);
</script>

Note: Google Analytics needs 24 hours to process the data received.

Note: We do not provide custom code assistance through the support team.

Have more questions? Submit a request
Was this article helpful?
0 out of 0 found this helpful

Need Further Help?

Tell us what you need and we will be happy to assist you.

Our team of expert support staff and our community can answer your questions. Submit a ticket, or reach out on live chat!