Advanced filtering on Google Analytics to grab referrals and convert them to external links
I've been segmenting my full referral
path to the user defined value
using advanced filters.
I would like that data, which obvious is the form of an URL to be clickable. Would even be better if it could open in a new window.
Anyone knows what I should feed the user defined value
to get that behavior?
I've put up an image to better explain what I'm trying to do (sorry for the blur but it was the only the client allowed). What I'm trying to do is put the yellow part (the full link path) as an external link so that I can click on it and just visit the site that brought the user here.
Any thoughts on how to do it?
Please take into account that the text given in the example is extremely short. On 90% of the referrals google cuts down the link showing the full path on the title only:
<div class="a" title="http://www.example.com/开发者_运维知识库vb/showthread.php?s=d0189c38">
<div class="b">http://www.example.com/vb/show</div>
</div>
Thanks!
So you're not alone in expressing a need for this feature, as evidenced by the fact that several people, including myself, have developed Greasemonkey scripts to do exactly this.
The most-recently updated of these scripts is named Google Analytics Referring Source Detail Links, and was written by Erik Vold. The source is available at the script repository, UserScripts.org
The page i linked to above includes an 'install' button in the upper left-hand corner, which if clicked from a Firefox browser that has the Greasemonkey add-on, will install this script as a greasemonkey 'user script'.
If you don't want to do that (i.e., you want to modify it first, or you user a different browser, then you can get the source from the same page i linked to. Chrome, for instance, allows you to install Greasemonkey user scripts as extensions, although i have not tried this. Similarly, Safari has a Greasemokey-like script injector from which to launch this script.
Instead of a greasemonkey change (which would break every time GA changes its DOM, which is often), you could just create a custom script that does this for you. This has the benefit of being future-proof (particularly since the GA API requires explicit declared version changes to use newer API features or lose access to old ones). Further, you could avoid overloading the User Defined variables, and leave them open for other uses.
Both the source domain (ga:source) and the referral path (ga:referralPath) are exposed via the API.
So, all you'd need to do to get the above view (or something similar) the way you want it is as such:
- Dimensions: ga:source, ga:referralPath
- Metrics: ga:visits
- Segment: gaid::-8 (referral traffic)
- Sort: -ga:visits
Try it here.
Here's what it looks like:
You could, using one of many popular Google Analytics libraries (here's one for PHP), just spit it out as such (pseudo-code)
<tr>
<td> <?php echo $referral['source'];?> </td>
<td> <a href="<?php echo $referral['source'] . $referral['referralPath'] ;?>" target="_blank"><?php echo $referral['source'] . $referral['referralPath'] ;?></a></td>
<td><?php echo $referral['visits'];?></td>
</tr>
There was really no good answer so I've made up an extension that you can install on Google Chrome to achieve this behavior.
It simply converts all the static text from "User Defined Value" into actual external links.
You can Install it from the Google Extensions page:
https://chrome.google.com/extensions/detail/dbbnhpimjhganelkoickiabfampiiagl
Hope this helps someone.
精彩评论