Hello all. I run multiple websites using google analytics. As you all know, google analytics breaks down your traffic by defined sources. My question to you is this. Would it be possible that when a visitor lands on any page the site, the same way analytics picks up the tracking source this new "script" would pick up the traffic source as well. Then, based on which traffic source it recognized, it would display a predefined image for visitors from that traffic source? I would only be interested in our top 10 traffic sources for each site, the rest we could just dump to a default image. The same default image goes for any visitors who come to the site and for whatever reason the script does not work correctly. The image would obviously need to be consistent from page to page. Thank you in advance.
A bit confusing. Do you mean, you wish to track the visitor, referer, and also google PR of the referer, and take cretain action based on these stats ? tell me more aobut it please. regards
I would like it to perform as so. 1. Visitor Enters Site 2. Script determines traffic source of visitor. (IE Google Organic) 3. Script knows to display image X in a certain part of the header which is set to display when a visitor arrives from Google Organic. 4. Image continues to display the same until that visitor leaves the site. I am not looking to track or catalogue any information about the user with this script. I simply would like it to display a predetermined image based on where the visitor is coming from. Thanks in advance.
Quite simple, Can you show me the sample url of Google Organic ? that redirects to your site? regards
Sorry, I am not sure I understand what you are asking for. Within analytics it shows up as "google / organic". Does this help?
Yes, it could be done. step 1: your script (which is executed on every page on your site BEFORE anything gets displayed in visitors browser) checks your visitor for your criteria (either for referral, useragent, cookie or anything else) step 2: your script saves cookie file on your visitors computer with some code that will tell your other scripts that such user is meeting your criteria (or doesn't save it if he's not meeting any criteria) step 3: your site scripts that display content need to check for the cookie and display one sort of content if cookie is found, or other sort of content if cookie is not found (can also be filtered by WHAT was found in that cookie). That's it. There are some exceptions that need to be taken into consideration there... For example not to check anything if your visitor referral is some of your site pages (which means that he is already browsing your site and came through some other page).. and probably some other, but this are the basic steps.
I would say the most difficult part of this would be to keep track of all of the referers that come to your site to determine the Top 10 traffic sources. You may want to store some information in a database to use for determining this.
Perfect answer pr0t0n. If I go translate proton's answer to code it will look something like this: <? $cookie_domain = ".yoursite.com"; #. + you domain name $referal = $_SERVER['HTTP_REFERER']; # refering page $to_be_tracked=false; # flag #array of urls, which will be checked if user came through one of them $refs_to_track = Array( #corrosponding image referal url to track "image1.jpg" => 'http://something1.google.com', "image2.jpg" => 'http://something2.google.com', "imageN.jpg" => 'http://somethingN.google.com' ); #do some checks #cookie value will be image only #if cookie already saved if(isset($_COOKIE['myCookie'])) { $image = $_COOKIE['myCookie']; $to_be_tracked=true; } else { $key = array_search($_SERVER['HTTP_REFERER'],$refs_to_track); if($key !== FALSE) { #referal found amongst array items $image = $key; #set cookie here for next hits setcookie('myCookie',$key,time() + (3600), '/', $cookie_domain); $to_be_tracked=true; } } #if current user came through desired referal, display him image if($to_be_tracked) echo "<img src='$image'>"; #Blah blah blah ?> Code (markup): I hope you can utilize this code to make your script. Let me know if you need more help. regards
As for finding the top 10 traffic sources, we have that information in analytics. We just need the code to use the same traffic source determination as the google analytics code, this will allow the two to line up. Would using a cookie mean that when that customer returns he will be counted as his original traffic source? Can we make it so that the cookie is removed after leaving the site? Whoever is interested in developing, installing, and supporting this script on all of my sites please PM me. My company is looking to hire someone to do this for us.
You can use sessions too and use routing technique passing session id across application till user is there, and if user closes the window id is lost and new unique session needs to be created. As far me, requirement is not clear enough to engage development services in this project. If you can provide more details on how exactly you wish this be integrated with google analytics, that will be good. regards
The only real "integration" with analytics would be using the traffic sources Identified by google analytics. I guess it really isn't "integration" I would just like to use analytics to identify the traffic sources in our reports. Then build the script according to the traffic reports. An example of the major traffic sources are... direct google / organic google / cpc yahoo / organic yahoo / cpc automobiles.honda.com / referral ect.... This is how they show up in analytics. I would just the script to be able to Identify these traffic sources for example. No real integration with analytics is needed. Thank you everybody for helping me fumble through this explination. I just don't have the knowledge to make it easier on you. =)