Use Google Analytics to track Google Form submissions - google-analytics

I'm using Google Forms (a Google Doc spreadsheet with an automatically generated form that the user can fill in to submit their details) and would like to track the submission of the form as a virtual pageview in Google Analytics so that I can measure conversions. Does anybody know if this is possible?

While Crayon Violent is correct about the built-in capabilities, there is a viable option: If you're able to host the Google Form HTML on one of your own pages, you can treat it like any other form (you can literally copy and paste the form HTML from the form page). As long as you leave the inputs unmodified, and the form action remains as its presented, it will post successfully to the form, regardless of where it is hosted from. (You can remove the styling elements if you wish.)
You can see a sample of that here: http://jsfiddle.net/PVBqX/2/
And you can see the data record just fine in the Google Spreadsheet here.
And, if you use Firebug or Webkit inspector, you'll see that the virtual pageview is sent:

There is an alternative solution to track pageview in Google Analytics using an image impression inside the Google Doc which I have been using it in my spreadsheet.
Check out the following link for the guide of explanation on how this works:
Tracking-google-sheet-views-with-google-analytics
For example, using little Apps Script will include the sheet key and locale in the image url (to include this you your own project open you Sheet and then Tools > Script editor and paste the code in):
function getGABeacon(tid){
var id = SpreadsheetApp.getActiveSpreadsheet().getId();
var locale = SpreadsheetApp.getActiveSpreadsheet().getSpreadsheetLocale();
return 'https://ga-beacon.appspot.com/'+tid+'/sheets/'+id+'/'+locale;
}
Then in the Sheet we can then use the cell formula like =image(getGABeacon("UA-48225260-1"))
EDIT
You can also build a tracked URL and pass it to the beacon on targetted page using this function
var trackURL = SpreadsheetApp.getActiveSpreadsheet().getUrl();

Probably you should just use Url shortner tool like https://goo.gl/ or https://bitly.com/ to get analytics on how many clicks are made and little bit of analytics like locations, browsers etc through them.

You can add Google Analytics in general by setting up a new page which includes the form using an iFrame and then adding the Google Analytics tracking code right before it.
I found a service that does exactly that and is completely free. It's called GFormAnalytics. It will generate a new link for you and then you share that new link and it will track your forms with your own Google Analytics tracking code.
Check it out here: https://GFormAnalytics.com

Here is what I did using Zapier (free basic plan), no coding needed:
How to use Zapier to trigger a goal conversion in Google Analytics (used with Google Tag Manager) when an embedded Google Form is completed
In Google Tag Manager click on Triggers to create a new trigger.
For trigger type, select "custom event."
Set it to trigger on "Some Custom Events."
Set the trigger to fire when the Page URL contains a unique part of a URL e.g. "/pages/contact."
Name (e.g. "Contact Form Submitted" and save the trigger.
Click on "Tags," then click "New" to create a new tag.
For tag type select "Universal Analytics."
For Track type select "Event."
Under "Event Tracking Parameters" for "Category" enter "Form Submission."
For "Action" enter "Submitted."
For "Label" enter "Contact Form."
Leave "Value" blank.
Under "Non-Interaction Hit" select {{Event}}
Under "Google Analytics Settings" select {{Google Analytics}}
As the trigger for this tag select the trigger you just created, "Contact Form Submitted" (or whatever you named it in step 5) which should show as a custom event.
Name the tag (e.g. "Contact Form Submission") and save.
Press "Submit" in the upper right corner to activate the new tag.
In Google Analytics, select the gear icon in the bottom left (Admin settings).
Under "View" select "Goals."
Select "Create New Goal."
Select the "Submission" goal template in step 1.
In step 2, under "Type," select "Event."
In step 3, for "Category," "Action," "Label" enter exactly the same thing you did in Tag Manager in steps 9-11 (case sensitive).
Leave "Value" blank.
Save the goal.
In Zapier, select "Make a Zap!"
For the Trigger App, select "Google Forms."
Select "New Response in Spreadsheet."
Connect your Google Forms account.
Choose the spreadsheet connected to your form.
Under "Worksheet" choose the "Form responses" that shows up in the drop down menu.
Select "Google Analytics" as your action app.
Select "Create a Measurement."
Connect your Analytics account.
Select your Account and Property.
Under "Type," select "Event."
For "Category," "Action," "Label" enter exactly the same thing you did in Tag Manager in steps 9-11 (case sensitive).
Leave the other fields blank.
Test and activate the zap.
Go to your website and fill out the form.
After at least 15 minutes (enough time for Zapier to have checked the spreadsheet linked to your form) check your goal conversions in Google Analytics to verify that the zap is working.

If you Edit the Form and select Responses menu, then select enter Tracking ID, paste in your tracking ID in and you will get page views as he goes to each page including the confirmation page which has Page Title of "Thanks!". This works even putting the link to the form in an email. Works great, tracking the mail open, then the pages and submit of the form, but I haven't figured out how to pass the user ID so both types of events carry the same user ID.

not possible. You have to be able to add code to the actual file being served.
Only thing I can think of is if it lets you redirect to one of your own pages after form submission, put the code on a page you create on your own site

Related

Aggregate pageviews on paths with variable parameters

We are using Google Tag Manager and Google Analytics to track page views and user behaviour in a Single Page Application.
The web application has several sections designed to be beneath a specific project URL, so we have this kind of application routing:
/projects/{projectId}/section1
/projects/{projectId}/section2
/projects/{projectId}/section3
So currently our tracking works like this:
/projects/abc/section1: 3 pageviews
/projects/xyz/section1: 7 pageviews
/projects/abc/section2: 10 pageviews
/projects/xyz/section2: 10 pageviews
/projects/abc/section3: 3 pageviews
/projects/xyz/section3: 2 pageviews
We now want to also gather aggregated per-section data, such as:
/section1: 10 page views
/section2: 20 page views
/section3: 5 page views
Is there any suggested way to do so using GTM or any Analytics settings that helps us aggregating these information?
Also we want to do this without having to modify the web application (we can modify the application but we prefer it to be kept as much agnostic as possible in regards of analytics tracking).
Assuming you use Universal Analytics (and not the new Google Analytics for Apps and Web), you could create a hit based custom dimension, which would allow for a custom report with hit based metrics (such as number of pageviews - "hit based" means this is tracked per request, "session based" would store only the last value in a session). This takes some preparations in Google Analytics, but implementation-wise it can be done in the GTM interface without touching the page code (provided that page tracking is already set up correctly for your SPA).
First go the GA admin interface, to the middle column with the property settings (custom dimension are created at property level) and search for "custom definitions". Expand, click "custom dimensions", click new. Enter a name, e.g, "Sections", select "hit-based" for the scope and make sure the "active" checkbox is checked. Click "save". In the overview you will see that custom dimensions have a numeric index, if this your first custom dimension the index will be "1".
Now, go to Google Tag Manager. Enable the built-in "page path" variable. Go to custom variables, click "new", and select "custom Javascript" as type. Write some custom script to return the last segment of your path. Custom Javascript variables take the form of an anonymous function, so this could look like this:
function() {
return {{Page Path}}.split("/").pop();
}
{{Page Path}} is the built-in page (the url without protocol, hostname and parameters), the split("/") splits it along the delimiter and stores the value in an array, and the pop() returns the last element of the array, so this will always give you the bit that contains the section.
Now go to your Google Analytics tag (either the settings tag, if you want this to be send on all hits, or your pageview tags, if you want this only in pageviews; in the latter case you will e.g. be not able to filter your event reports by section). In the "custom dimensions" setting (under "more settings" in the pageview tag) click "add custom dimension". In the index field enter the numeric index for the dimension you have created in GA. In the value field, enter your "section" variable ({{Section}}, GTM variables are denoted by double curly brackets in the interface). Save, publish, wait a few hours, create a custom report with the custom dimension as primary dimension (custom dimensions do not show up in standard reports), add all hit-based metrics you want (e.h. page views) and you should be good to go.

track URL click on email with GTM

I was wondering how can we track a click on a link sent via email using Google Tag Manager.
I mean, the user gets an email that contains an URL to our website, we would like to know if the user clicks on that link.
Is it possible to do it all just using the GTM console or do we have to add some extra code to fire up the event?
To be pedantic, you cannot track the "click" on the link since the mail itself does not contain tracking code or GTM code.
However you can append a parameter to the link (if you are using Google Analytics you should tag all of your links with campaign parameters in any case). Then you can check within GTM (e.g. via a url type variable with component type set to query string) if the parameter is present and then fire your tags accordingly.

Google Tag Manager Form Submission and form Click

In my website I have a link that direct user to form submission page.I want to track how many user have clicked the link and also have click the submit button after filling the form
I want do the implementation using Google tag manager
You can use 2 virtual pageviews and one goal with a funnel. One pageview will be for link click and other will be for form submition.
You'll want to use a Form Click Listener (see https://support.google.com/tagmanager/answer/3415369?hl=en). Make sure the "Wait for Tags" option is selected when you're setting up the listener. Also make sure it sends an "event", not a "virtual pageview".
It's better to use an event rather than a virtual pageview in this case. Using a virtual pageview will inflate your pageview stats, causing them to be a lot higher than they should be. Virtual pageviews should be used in situations where something happens that should be counted as a pageview but the page doesn't actually change - for example: content loading in a page whose URL doesn't change).
I hope this helps. Please comment if you need clarification.

google analytics event tracking for individual users

Hi am using google analytics ga.js to track a button click event. It is working fine. However, i want to track the button click event for individual users in my site.(eg. karthik - 5, Richard - 7 etc ) Am using wordpress. How to achieve this?
There are ways track non PII user data using Google Analytics. This is an example of importing CRM user data, which you could use import the type of information you are looking for.
Basically you can send in a User Scoped Custom Dimensions which represents a user with the hit data,and then import a CSV to map that dimension to any other user scoped custom dimension.
I have find a solution for this. I have used event tracking to achieve this. I have used the following function in the click event of the button.
_gaq.push(['_trackEvent','button-category','Click','Clicked by the user:User id from my site ']);
In the label field i use the logged in user id from my site. Now, i can see the clicks of a particular user using his id under Behavior->Events->Pages->Your Page->Event Category->Event Action->Event Label. As username is personally identifiable info according to google, i didn't use username.

How to call _trackPageView from Google Tag Manager for an AJAX page?

I have a page loaded in via AJAX.
In Google Analytics I could have just called gaq.push('_trackPageView','/someurl') in my AJAX success function. However I can't seem to find a way to do this when implementing GA via Google Tag Manager.
The only alternative seems to be a "virtual page view" event, which isn't exactly what I'm after:
Does anyone know how to do this?
on the Ajax success, do:
dataLayer.push({
'event':'sendVirtualPageview',
'vpv':'/blah/blah'
});
The 'event' is just to send the virtual pageview to GTM. It's not a traditional, although it could be, Google Analytics event.
You should be able to folllow the rest of the tutorial to create your rule and setup the tag type.
Here's how you enable Virtual Page Views on your Google Analytics tag in GTM.
GTM v2:
Go to the Variables page. Enable the Event variable {{event}} by ticking the Event checkbox inside Utilities under the Enable Built-in Variables heading.
Create a variable named Virtual Url with type Data Layer Variable and set the Data Layer Variable Name to "virtualUrl".
Go to the Triggers page. Create a trigger named Virtual Page View with type Custom Event and set the Event name to "virtualPageView".
Create a tag GA Virtual Page Views with product Google Analytics Universal. Set your Tracking ID UA-xxxxxx-xx. Set the track type to Pageview.
Under More Settings > Fields to set, click + Add Field.
Set Field Name to page with value {{Virtual Url}}.
You can add additional fields here, such as title, UTM campaign etc. Add variables then add them here.
Click Continue. Under Fire On, click More. In the triggers popup, tick Virtual Page View. Click Save.
Click Create Tag.
GTM v1:
Create a macro {{Virtual Url]} referring to dataLayer variable "virtualUrl".
Create a {{Virtual Page View}} rule as {{event}} equals "virtualPageView".
You should already have an {{event}} macro, but if you don't, create one using the dataLayer variable "event".
Updates to your Google Analytics tag:
More Settings > Basic Config, tick "Virtual Page Path" and use macro {{Virtual URL}}.
Remove the {{All Pages}} firing rule.
Add the {{Virtual Page View}} firing rule.
GA Fields:
page = the path portion of a URI. eg. /blog/topic/post.html
title = used to specify the <title> contents
campaignMedium = used to specify the URI utm_medium
campaignSource = used to specify the URI utm_source
campaignTerm = used to specify the URI utm_term
campaignContent = used to specify the URI utm_content
campaignName = used to specify the URI utm_campaign
Usage:
In your web app, call it like so:
dataLayer.push({
'event': 'virtualPageView',
'virtualUrl': '/relative/page/path',
'virtualTitle': 'My page title'
});
You can rename any of the variables above - this is just an example based on how we do it.

Resources