Having Issue with Site Search in Analytics
-
Hi Mozzers,
We launched a website in October 2012 and have added in the settings(Google analytics) of that profile "Do Track Site Search" since we have a search box on the website. The site search report worked for 10 days and it was over(from end of december till beginning of January 2013). Since then I have been trying to understand this issue. I have added all the query search terms possible, but still not showing any signs of life.
At this point I am not sure what to do? Some Help would be appreciated!
Search URL= subdomain.example.com**/search/node/**....
Thanks!
-
Hi,
I assume your subdomain is tracking and you are seeing the unmodified search urls in your analytics site content data and it is just the internal site search tracking that is not working?
So in the link above (assuming the js is all correct, I have not tested it) you would need something like this if the search URL looks like: subdomain.example.com**/search/node/keyword**
var s = location.pathname;
var re = new RegExp(“/search/node/([^/]*)/?$”);
var m = s.match(re);
pageTracker._trackPageview(‘/search/?q=’ + m[1]);What you are doing is getting the initial url, then setting up a regex to get anything after /search/node/ (your keywords in other words) and then pushing these keywords into a virtual page view that analytics can understand as a site search query. Worth noting that this code should only be on your search results page, not all pages of the site. if you have a dev environment you can make sure all the variables (s,re,m) are returning what you expect by just alerting them like: alert(s); etc etc.
This should give you virtual pageviews that you can actually see in your analytics site content reports that will look like /search/?q=YOURKEYWORDS, and if you see those then you just need to set up normal analytics site search tracking as you already had with q as your variable.
It may be easier to do it in php or whatever language your site is coded in, the issue is to isolate the search keywords in whatever way is easiest for you and then do the virtual page view in analytics with the pageTracker._trackPageview(‘/search/?q=YOUR_KEY_WORDS');
Hope that helps!
-
Hi guys,
Unfortunately I don't have any programming knowledge so I am having an issue understanding what I need to use as a regex for the javascript modification here
"var s = location.pathname;
var re = new RegExp(“/search/([^/]*)/?$”);
var m = s.match(re);
pageTracker._trackPageview(‘/search/?q=’ + m[1]);
*Assuming the results page is in the format http://www.mysite.com/search/keyword
and further assuming my JavaScript and regex are even remotely accurate – meaning don’t just use this example code and expect it to work, this is to demonstrate the concept only"As I said the search URL looks like: subdomain.example.com**/search/node/keyword**
Thanks for your help
-
thanks Lynn for your answer.
I'll try to follow the details you sent me.
-
Hi,
Lynn is probably right, things don't stop working if nothing changes. If you would be able to share the site with us we can help you out probably.
-
Hi,
If it worked for a few days then something must have changed after that. Maybe you went from a search url looking like /search?q=myterm to something like /search/myterm? To track site search without the query string in the url you need to do a bit of fiddling with analytics to create a virtual page view. See this page for details on setting it up. Worth mentioning also to make sure you are properly tracking your subdomain just in case.
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
What Analytics Do You Use To Track IOS and Android?
We have about 600k downloads of our app and would like to know what cost effective analytics tool you use to gain insight into what your app users are doing? Thanks! Best... Mike
Reporting & Analytics | | 945011 -
Organic vs SEO in Analytics
In my analytics account, the Acquisition / All Traffic / Google organic searches shows me around 19,000 hits from 1st Jan to 1st Feb. But if I go to the Search Engine Optimization tab / Queries or Landing pages I can only count 1,800 clicks from 1st Jan to 1st Feb. Why such a huge discrepancy ? Am I getting 1800 clicks from the Google organic search, or 19,000 ?
Reporting & Analytics | | coadr930 -
How do I cancel a scheduled Dashboard report in Google Analytics?
I created a few Dashboards in Google Analytics and scheduled them to be emailed for the next 6 months. Now I want to cancel those scheduled emails and am not finding those Dashboard reports/emails anywhere so I can cancel them. Do you know how to stop these emails from being sent?
Reporting & Analytics | | cindyt-170380 -
Google Analytics Not Tracking 100% of Visits?
Hi all, We're having an issue with Analytics where we are getting different figures from what Silver Pop are saying. For example email campaign A sent via Silver Pop, with Google Analytics tracking code show's 50 unique clicks in Silver Pop. Looking at Google Analytics there are only 10 visits from that campaign. So I thought it could be something with the tracking, but there wasn't a significant rise in web visits = either Google Analytics is not recording visits properly or Silver Pop figures are wrong. I'm more inclined to think that it's something to do with Google Analytics. Has anyone come across something similar? Where one system is showing you X amount of visits but the figures on Google Analytics don't add up? A few quick things already covered: Double checked the links have been tracked properly, but this doesn't explain the low increase in web visits generally We've double checked that Google Analytics tracking code is properly installed (and it is / was at the time of send). Any help would be much appreciated! Thanks guys.
Reporting & Analytics | | RKHStaff1 -
Google Analytics Not Working
I added the code before tag but still google not showing it is installed. Status: Tracking Not Installed Last checked: Mar 15, 2013 10:38:10 PM PDT Can someone check my domain - www.plugnbuy.com
Reporting & Analytics | | chandubaba0 -
Image Search Keyword Tracking With Google Analytics
Does anyone know how to track keywords for your images in Google, Yahoo, Bing (/imgres)?
Reporting & Analytics | | Melia0 -
Set up Google Analytics by product category
Does anyone know if it's possible to set up Google Analytics data by product category? We sell roughly twenty product categories on our ecommerce site. We can look at our analytics performance for the site overall and drill down to specific pages, but what we really want to see is our performance by product category. Our product categories can include up to 5000 products. Any pointers on how to do this?
Reporting & Analytics | | ironpac0 -
How to filter pages in Analytics by multiple criteria
Hello, we have several pages with the same page title. Now out of all those pages I want to pick two. Let's call them "/page1" and "/page2". For those pages I want the following information (combined for both): Avg. time on page, Bounce rate, Navigation Summary Normally I get all the information under "Content" "Pages" and by choosing the "page title" as primary dimension and clicking on the respective page title. Let's call it "page | title". Choosing the filter for 1 page works fine (I just enter "/page1" in simple filter). But how can I filter for two pages ( entering " include page ends with /page1 and include page ends with /page2" in the advance filter will show 0 results). Thanks in advance
Reporting & Analytics | | guitarslinger0