How to Create Google Analytics Events on Google Tag Manager

This guide explains the process required to pass Frase events into Google Analytics (GA), provided you've installed GA via Google Tag Manager.

Ready? Let's do it.

0. Create Frase Answers Tag

Before setting up Google Analytics events, make sure you've installed Frase first. To do so, you would have created a new Tag, and pasted your Frase Javascript Snippet. If you have any questions about this step, please refer to this guide on how to install Frase via Google Tag Manager.

1. Create Event Tag

Once your Frase Answers tag is created, we will create a new tag for your event. We can start by creating the "Frase Input Event" tag. We will use this event to track when visitors ask a question to Frase.

  • Type Type: "Google Analytics: Universal Analytics"
  • Category: "frase"
  • Action: "frase_input"

2. Create Trigger

We will also create a Trigger.

  • Trigger Type: "Custom Event"
  • Event Name: "frase_input"
  • This trigger fires on: "All Custom Events"

3. Map Event Tag to Trigger

Your trigger is now mapped to the event tag.

4. Send Frase Events

Go back to the Frase Answers tag where you pasted your Javascript Snippet. You will then paste the Event Tracking code, so we can send events to GA every time Frase users interact with your widget. The code looks like this:

<script>
frase.on("ready", function(){    
	frase.on("frase_input", function(){  
		window.dataLayer.push({
          		"event" : "frase_input"
        	});
	});
});
</script>

5. Preview and Test

Save your changes, and click "Preview". This will open your website, and display your Frase Assistant. 

Ask a question to your Frase Assistant, and you should see your event populate under "Tags Fired":

6. Submit Changes

You are all set, submit your changes!

If you would also like to track "Funnel Funnels", repeat the same process but use the event listener for "frase_funnel" events when logging the event:

frase.on("frase_funnel", function(){   		
	window.dataLayer.push({           		
		"event" : "frase_funnel"         
	}); 	
});

7. Review Google Analytics Events

It may take a few hours for GA to start recording events. We suggest you check a few hours later, and navigate to your "Events" section.