Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Internal Site Search Data in Google Analytics

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 10-19-2010, 09:39 PM
 
kwaterman kwaterman is offline
 

Newbie
  
Join Date: Mar 2010
Posts: 1
 

Default Internal Site Search Data in Google Analytics

Hi There
Brand new member to the forums here posting for the first time - hoping someone has some experience with this as I've spent a lot of time banging my head against this particular wall.

I'd like to be able to track internal site search terms within Google Analytics, but so far am having no luck. It looks like the analytics data is looking for a particular query parameter like a "q" or "s", but of course the search results URL doesn't show this type of thing - only http://www.domainname.com/search.php?mode=search&page=1". Does anyone know what changes I'd need to make, and to which template files? I have the latest Asynch GA code already in place.

Thanks very much!
Kathy
__________________
X-Cart Gold, V4.3.0
Reply With Quote
  #2  
Old 06-17-2011, 02:09 PM
  Jayk's Avatar 
Jayk Jayk is offline
 

eXpert
  
Join Date: Nov 2003
Location: Calgary, Alberta, Canada
Posts: 333
 

Default Re: Internal Site Search Data in Google Analytics

Hi Kathy,

Did you ever figure this one out?

Thanks,
Jason
__________________
X-Cart Gold 4.4.3
Blog: www.flashinthepan.ca
Reply With Quote
  #3  
Old 02-02-2012, 06:52 AM
 
Acquamarina Acquamarina is offline
 

X-Adept
  
Join Date: Aug 2006
Location: USA
Posts: 811
 

Default Re: Internal Site Search Data in Google Analytics

Found this through another post. The code is very different on 4.4.4. Will it work?

http://www.squeezejuicemarketing.com/blog/capture-site-search-terms-in-x-cart-w-google-analytics/
__________________
Vera B
4.4.5
CFLSystems.com mods, Kosmos eBay Integration, Feed Manager Pro, custom mods, BCSEngineering Mods, CDSEO PRO
Hosting by EWDHosting - The best home for your x-cart.
Reply With Quote
  #4  
Old 02-06-2012, 02:19 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Internal Site Search Data in Google Analytics

Quote:
Originally Posted by Acquamarina
Found this through another post. The code is very different on 4.4.4. Will it work?

http://www.squeezejuicemarketing.com/blog/capture-site-search-terms-in-x-cart-w-google-analytics/

For 4.4.x you can try altering the "skin/common_files/modules/Google_Analytics/ga_code.tpl" template and replace this code:
Code:
pageTracker._trackPageview();
with this:
Code:
{if $main eq "search"} searchterms='{$search_prefilled.substring|escape}'; searchterms=searchterms.toLowerCase().replace(/\s/g,'+'); pageTracker._trackPageview('/search?q='+searchterms); {else} pageTracker._trackPageview(); {/if}

The second step (from the reported instructions) is still required.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote

The following user thanks qualiteam for this useful post:
Acquamarina (02-06-2012)
  #5  
Old 02-06-2012, 04:40 AM
 
Acquamarina Acquamarina is offline
 

X-Adept
  
Join Date: Aug 2006
Location: USA
Posts: 811
 

Default Re: Internal Site Search Data in Google Analytics

Thanks, Alex, I'll do the changes and report back tomorrow.
__________________
Vera B
4.4.5
CFLSystems.com mods, Kosmos eBay Integration, Feed Manager Pro, custom mods, BCSEngineering Mods, CDSEO PRO
Hosting by EWDHosting - The best home for your x-cart.
Reply With Quote
  #6  
Old 02-06-2012, 04:50 AM
 
Acquamarina Acquamarina is offline
 

X-Adept
  
Join Date: Aug 2006
Location: USA
Posts: 811
 

Default Re: Internal Site Search Data in Google Analytics

Forgot to ask - the query parameter is "q", as in the fix from squeezejuice?
__________________
Vera B
4.4.5
CFLSystems.com mods, Kosmos eBay Integration, Feed Manager Pro, custom mods, BCSEngineering Mods, CDSEO PRO
Hosting by EWDHosting - The best home for your x-cart.
Reply With Quote
  #7  
Old 02-06-2012, 04:55 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Internal Site Search Data in Google Analytics

Quote:
Originally Posted by Acquamarina
Forgot to ask - the query parameter is "q", as in the fix from squeezejuice?

Yes
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #8  
Old 03-03-2012, 11:37 PM
 
Nacho Nacho is offline
 

Newbie
  
Join Date: Nov 2006
Posts: 4
 

Default Re: Internal Site Search Data in Google Analytics

Thanks Alex,

What about if we are using GA Async mode?

What should be the change in this case?

Regards,

Nacho.
__________________
www.diamondiberica.com
Xcart 4.0.7
Reply With Quote
  #9  
Old 03-06-2012, 02:56 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Internal Site Search Data in Google Analytics

The regular async script looks like this:
Code:
<script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script>

I suppose you use 4.0.x, thus in skin1/customer/home.tpl before the Google tracking code appears, add this:
Code:
{if $main eq "search"} {assign var="searchterms" value=$search_prefilled.substring|escape}; {/if}

Change the tracking code like this:
Code:
<script type="text/javascript"> searchterms = '{$searchterms}'.toLowerCase().replace(/\s/g,'+'); var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); if (searchterms) { _gaq.push(['_trackPageview', '/search?q='+searchterms]); } else { _gaq.push(['_trackPageview']); } (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script>
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions

Last edited by qualiteam : 06-22-2012 at 01:14 AM. Reason: typo
Reply With Quote
  #10  
Old 03-06-2012, 03:03 AM
 
Nacho Nacho is offline
 

Newbie
  
Join Date: Nov 2006
Posts: 4
 

Default Re: Internal Site Search Data in Google Analytics

Thanks Alex, but my question was for x-cart version 4.4.5
__________________
www.diamondiberica.com
Xcart 4.0.7
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:32 AM.

   

 
X-Cart forums © 2001-2020