Data Studio
2.6K members online now
2.6K members online now
Ask questions about Data Studio
Guide Me
star_border
Reply

Tracking Form Submitters Source/Medium through GA API

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello everyone,

 

I have a form on the website. When users fill this form out I want to get not only their personal information, but also “source” and “medium” from which these visitor came.

 

Could you please tell me if there is a way of getting “source” and “medium” values for form submitters through Google Analytics API? And how can I set this up to work properly.

 

Any help would be much appreciated!

 

Thank you!

1 Expert replyverified_user

Re: Tracking Form Submitters Source/Medium through GA API

Rising Star
# 2
Rising Star
Hi Darya,

With Universal Analytics the only information is the client id which is stored in the _ga cookie. Presently the client id is not a dimension on which you can query in the API. In the UI it's exposed in the User Explorer report but that is not a scalable to retreive data Smiley Happy

In cases like these you can either use Ecommerce functionality and set a transaction Id and then query the API or you can set something like the client id in a custom dimension and then query the API based on the custom dimension.

More on Custom Dimensions and Ecommerce:

https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets

https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce

Best,

Theo Bennett
Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn

Re: Tracking Form Submitters Source/Medium through GA API

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hi Theo,

Thank you very much for your reply.

Sorry, I should have been more specific.

I want to receive these user values (source/medium) in emails that I get after the form on the website is filled and submitted by a user.

As an example (information that I want to receive in the email after the form is submitted):

First name: _____
Last Name: _____
User Email: _____
Source/Medium: google / organic (if the user came from Google's organic search)

Is it possible to connect mailer with Google Analytics to get this data?

Thanks again!




Re: Tracking Form Submitters Source/Medium through GA API

Rising Star
# 4
Rising Star
Hi Darya,

With Universal Analytics it's just not available, you have to look it up using one of the methods I mentioned. There is another way to do it, you can also deploy a classic analytics tracker and send data to a different property.

In classic analytics the _utmz cookie is used to store campaign data. Justin Cutroni, Analytics Advocate at Google has an old post on that here:

http://cutroni.com/blog/2007/10/29/integrating-google-analytics-with-a-crm/

There are two problems with this:

1. You only get last click attribution but you could also set a goal for this and look at the multi-channel reports to see in aggregate how your marketing mix works together.

2. This should not be considered a stable long term solution as Google has announced that at some point they will deprecate ga.js (but you could host code base locally)

Lastly if you want full campaign data from AdWords you'll need to manually tag and use auto-tagging which works but is not considered a best practice.

If you are using GTM, this is super easy to do. Smiley Happy

Best,

Theo Bennett
Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn

Re: Tracking Form Submitters Source/Medium through GA API

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
Thank you very much Theo!

So as I understood, I can get the information I need in the email using Google Tag Manager?

Thank you!

Re: Tracking Form Submitters Source/Medium through GA API

Rising Star
# 6
Rising Star
Well Darya,

You need to deploy ga.js version of the Google Analytics tracking code for Google Analytics to begin storing the_utmz cookie that holds that campaign information. If you are using GTM, you can simply add this tracker by deploying the classic Google Analytics tracking code - do this with a different web property which you first create in the admin section of Google Analytics.

https://support.google.com/analytics/answer/1042508?hl=en

Then you need to have your developers deploy (either on the form or via GTM) a version of the code mentioned in Justin's post. The code will parse the cookie and store it's values in hidden fields in your forms. Then they will pass them into the email.

So you need:
1. The ability to add hidden form fields
2. A new web property
3. To deploy classic analytics (you do this while still using universal analytics)
4. A developer to take the code and parse the cookie and pass it into the form fields for storage etc.

Hope that helps!

Best,

Theo Bennett

Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn

Re: Tracking Form Submitters Source/Medium through GA API

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
Thank you very much for your help Theo!