Is there a way in Google Analytics to get a visitors information in real time in order to personalize content?
For example, visitor A comes from Google using the "widgets" keyword and using a Chrome browser so I want to show him content related to Chrome based widgets.
Google Analytics provides a Real Time Reporting API as a developer preview in limited beta.
Real Time Reporting API Private Beta access request form.
With all the limitations that this means it may be worth giving a try.
You can find Java, PHP, and Python code examples on the documentation page: https://developers.google.com/analytics/devguides/reporting/realtime/v3/reference/data/realtime/get
In PHP this is the anatomy of the call to the API:
$optParams = array(
'dimensions' => 'rt:medium');
try {
$results = $analytics->data_realtime->get(
'ga:56789',
'rt:keyword',
$optParams);
Probably not. Even if you request from the the Real-time API keyword you will find that. The Keyword returned is the Keyword from your own campaign tracking. So this would only work on links that you sent back to yourself Which really isn't what you want to do. Its a nice idea really
Documentation: rt:keyword
When using manual campaign tracking, the value of the utm_term
campaign tracking parameter. When using AdWords autotagging or if a
user used organic search to reach your property, the keywords used by
users to reach your property. Otherwise the value is (not set).
What you are looking for is the keyword that would be used against a search engine. That keyword isn't returned via the Real-time api.
Related
I asked this question in other forums, and didn't have a solution so far.
I would like to have Google Analytics' source and medium added in every form sent by my websites, as hidden fields.
I use WordPress, and the plugings that I commonly use for contact forms are Contact Form 7 and Fast Secure Contact Form.
Any ideas?
Thanks in advance!
-- Gabriel
There isn't really a way.
It used to be that channel attribution was computed in the GA tracking code in the client, and you could extract it from the cookie values. However since Google has switched to the measurement protocol (which is what's behind both analytics.js and gtag.js) attribution is determined on the Google servers and there is no really feasible way to get the information in realtime to include it in a form.
You could create a script that emulates GA attribution, but the rules are somewhat complex and it is unlikey you would get an exact match.
Another way (which, if you are in Europe, might bring you in conflict with the new privacy guidelines from march on) would be to save a unique token with the form, send the same token as custom dimension to Google Analytics, and then join the information after the fact via the API. Some time ago I described the process in a tutorial, and even if this is for salesforce (and the specific code most certainly obsolete) it describes the problem and the solution somewhat exhaustively.
I have asked this question several times over on the GA forum, but no result. So maybe you guys can help...
I have set up google analytics with userIds on various pages of a site, with the aim of identifying exactly which pages are looked at by which users. So, sending GA the string
ga('create', 'UA-39536320-1', {'userId': '1001'});
means GA keeps track of all accesses by user 1001, and I can then (in theory) track all pages looked at by this user.
Trouble is, GA reporting seems to offer no out-of-the-box way of doing this. Indeed, some of the reporting features supposedly enabled by GA with userIds just don't seem to be available (eg coverage; user engagement; etc).
Am I the only one trying to do this? Seems other people have achieved a similar result using custom variables; do I have to do that, and give up on GA userIds?
The userId feature can be used in conjunction with a user id enabled view (profile) to analyze cross device sessions.
As pointed out by DalmTo it is possible to use custom dimensions to track any non PII information about a user. This article here gives a good example combining sending user scoped custom dimensions along with imported CRM user data to analyze and segments users for remarketing purposes.
Implemented a filter on a webservice to make gif calls to GA for tracking method calls.
During initial testing I set a custom variable that contained account information. But for some reason, after a few weeks the variable stopped coming through to standard reporting correctly.
A test gif url:
http://www.google-analytics.com/__utm.gif?utmwv=4.4sj
&utmn=230567348
&utmhn=localhost
&utmr=-
&utmp=http%3A%2F%2Flocalhost%2Fv2svrmng%2FServiceManagerV2
&utmac=UA-12345678-9
&utmcc=__utma%3D999.999.999.999.999.1%3B
&utmvid=0x6ffa39da7d6bd0c7
&utmip=127.0.0.0
&utme=8(Account)9(testaccount-99999)11(2)
The Account key seems to be read correctly but the testaccount-99999 value appears as (A
Is some sort of weird truncation occurring here?
The gif request is not a supported or documented API. You can only use it with the javascript library provided or other google libraries that communicate with Google Analytics.
The good news is that Universal Analytics is a new update to Google Analytics (currently in Public Beta) and it has a documented protocol to send data to GA using server side code like you want.
Read more about it and how to get into the Beta here:
https://developers.google.com/analytics/devguides/collection/protocol/v1/
In my app, there's a requirement to track search queries, which individuals to the app. The point here is to track specifically individuals/search_queries, i.e. I want to be able to say:
User 10.20.30.40 (IP is derived from client, ok) came to my website
from Google's search results page of 'hello world' query
Is that even possible?
I investigated the problem a bit. It turned out, that when the user on Google Search result page clicks a link and gets to the underlying page, the referer doesn't contain the search query. Say, for example, I entered a "Hello world" query...
I open google and enter a "Hello world" query;
I see a serach result page with a link to wikipedia on top; I follow it
I enter "document.referrer" in consonle to see:
http://www.google.com.ua/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CGkQFjAA&url=http%3A%2F%2Fru.wikipedia.org%2Fwiki%2FHello%2C_world!&ei=HZ0fUIXTIordtAau54GwAQ&usg=AFQjCNHSAHv8NwVNdaxMvh0OhIxs6Zb1rQ&sig2=a8tEGTBNcFWOPykloXj_Xg
There's a &q= param with a blank value, preventing me to figure out the query the user entered.
I believe Google internally uses some of the query params (i.e. ved, ei, usg or sig2) from the URL above to keep track of query used to get to the site, and thus gatehr the statistics about which queries are used mostly to the get to the website. I couldn't find any information regarding how to use them.
In the meantime, Google Analytics would only gather a general statistics, not for individuals. Yet I noticed that there's an ability to use Custom Variables. Is it possible to use them somehow in order to track query the user came with? If so, wouldn't it be a violation of Google Analytics Terms Of Service?
So again: is there a way to know a search query one came to the site with?
This is not possible. Google erases the value of q parameter, so instead of
`?q=search+query`
one always observs.
`?q=`
Though, Google provides another way (the so called convinient one) to know which queries were used to come to your website: Google Analytics.
Also, it's impossible to track user_ip/search_query pair due to Google Analytics ToS.
I am trying to build URLs for Google Analytics and Omniture.
GA is simple enough, and those URLs can be built using http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55578
Campaign Source: * (referrer: google, citysearch, newsletter4)
Campaign Medium: * (marketing medium: cpc, banner, email)
Campaign Term: (identify the paid keywords)
Campaign Content: (use to differentiate ads)
Campaign Name*:
Does anyone know how Omniture links are constructed? Do they support this kind of URL?
Omniture does not grab predefined var=value params from a URL like GA.
What you can do though is use omniture's s.getQueryParam() plugin to grab the same parameters generated by that GA tool, and put them in s.prop and/or s.eVar variables.
The basic Omniture campaign tracking is based on the s.campaign parameter, which can be then re-defined (classified) using the SAINT tool. The "cid" (default) URL parameter only takes one value, by default a running number, which is then classified with SAINT. Fetching the value can be done with a plug-in, such as getQueryParam(), which is recommended.
I don't recommend using prop or eVar variables too much on this, since without DataWarehouse or Discover you can't really use several of them in a segment (max. 2) and this makes using 5 parameters quite useless.
The SAINT tool together with the campaign parameter is quite powerful and should be enough for basic needs.