News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Search Stats

Started by camoura, September 26, 2010, 11:50:50 PM

Previous topic - Next topic

camoura

i nice would be having a log of all searched words.

In time, I am trying to use google analytics to track searches but SMF only shows search url´s as "index.php?action=search2"

How can I add the searched words to the url so google can track them?

Thanks!

live627


Yağız...

That was already done by husmen73 (Gulhin) and シナン, but it's removed from the mod site. Maybe PM'ing them can help you to find the modification :)

Joker™

Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

camoura

Joker,

I am using RC3 and there is a search.template.php file. Is that the one I should modifiy?

I tried modifying index.template, but it does not change a thing. Maybe because I don't have any search box on the pages?

Having the keywords shown in the url is enough for now. I just need to know then how to set google analytics to track the search words.

camoura

here is search.template.php

Joker™

What i posted will make search url's as

www.yourforum.com/index.php?action=search2;search=keyword_you_have_searched  (as happen here on smf)

also in the post .. http://www.simplemachines.org/community/index.php?topic=357785.msg2739675#msg2739675

i haven't mentioned and search.template.php , all you have to do is just make a search.php and modify your index.template.php
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

camoura

I did that, but it did not work.

It is still www.yourforum.com/index.php?action=search2

No keywords are shown.

camoura

#8
I managed to modify search.template, but now when I search something I only get a blank page with url www.myforum.com/search.php

update: I getting now:

Fatal error: Call to undefined function phprequire() in /myforum.com/search.php on line 3

camoura

well I managed to get it working somewhat. There was a copy and paste error in search.php.

It is showing the url with the keywords, but it seems I cannot use advanced search.

Again, I had to modify search.template.php to get it working.

Any help with that?

camoura

oops. it will take sometime to figure this out.

Search does not work for guests. It keeps asking for the correct captcha even though I am typing it correctly.

Joker™

Actually you are confusing everyone, as i've not mentioned to change search template anywhere. So, better if u can tell exactly have have you changed.

For demo you can see my forum, the search thing is already working there.
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

camoura

Sorry, I am really confusing everyone.

Is FreakyGurus your forum? If so, I notice it really works for the form field top-right.

I don't have that field, so when I click the Search tab it shows the full search page. And like yours, the url modification does not work.

I am using the SilentWave theme from dziner studio. Looks alot like yours.

In search.template.php whereever I found:

action="', $scripturl, '?action=search2" changed to action="URL/search.php"

and

name="search" to name="query"

It happens that every search turns to simple search.  That is, even if I select just one board it shows results for all boards.

And guests can search because of catpcha. It keeps asking for the correct letters.

Joker™

Quote from: camoura on September 27, 2010, 03:21:52 PM
Sorry, I am really confusing everyone.

Is FreakyGurus your forum? If so, I notice it really works for the form field top-right.

I don't have that field, so when I click the Search tab it shows the full search page. And like yours, the url modification does not work.

I am using the SilentWave theme from dziner studio. Looks alot like yours.

In search.template.php whereever I found:

action="', $scripturl, '?action=search2" changed to action="URL/search.php"

and

name="search" to name="query"

It happens that every search turns to simple search.  That is, even if I select just one board it shows results for all boards.

And guests can search because of catpcha. It keeps asking for the correct letters.

Yup freakygurus in mine site and theme is silent wave.

URL/search.php << here replace URL with your site address , like for me the complete link is
http://www.freakygurus.com/search.php
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

camoura

Yes, I did that. It is working for simple search.

But again remember that I have no search field, only the search tab that takes me to the full search page, which I believe is the search.template.php.

Still I don´t know how to solve:
- It happens that every search turns to simple search.  That is, even if I select just one board it shows results for all boards.

- And guests cannot search because of catpcha. It keeps asking for the correct letters.

Joker™

Some creepy code i managed to get out,

Save this in search.php
<?php
//Path to SSI.php
require(dirname(__FILE__) . '/SSI.php');

$redir = 'action=search2';

foreach (
$_POST as $var => $val)
{
if( is_array($val) )
foreach ($val as $vala => $valb)
$redir .= ';' . urlencode(stripslashes($var)) . '[' . urlencode(stripslashes($vala)) . ']=' . urlencode(stripslashes($valb));
else
$redir .= ';' . urlencode(stripslashes($var)) . '=' . urlencode(stripslashes($val));
}

redirectexit($redir);

?>



In search.template.php
Find:
<form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '" name="searchform" id="searchform">


Repalce it with

<form action="Siteurl/search.php" method="post" accept-charset="', $context['character_set'], '" name="searchform" id="searchform">


I've not tested it completely , hope you'll give positive feedback on this :).
Just noticed ,even my forum was lagging this on advance search page .
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

camoura

Thanks Joker !!!!

It seems to be working nicely.

The search url gets pretty long, but I don't think this is a problem. I just need google analytics to track the search terms.

By the way, do you know how do I set up Google Analytics to track the searches?

Forum shows index.php?action=search2;advanced=1;search=KEYWORD;searchtype=1;userspec=%2A;sort=relevance%7Cdesc;minage=0;maxage=9999;brd[1]=1;brd[2]=2;brd[9]=9;brd[11]=11;brd[12]=12;brd[13]=13;brd[6]=6;brd[7]=7;brd[8]=8;brd[4]=4;brd[5]=5;brd[3]=3;brd[14]=14;all;submit=Search

What should I put in: Query Parameter ?

I gonna try only search to see what happens.

Thanks again !!!

Joker™

Quote from: camoura on September 28, 2010, 05:34:22 PM
What should I put in: Query Parameter ?
what ,when, where :o , i mean what's query parameter. (Please forgive my childish questions ;D)
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Xantheon


Joker™

Has this post started in mod requests ? afair it was in coding discussion. Isn't it?
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Advertisement: