Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to log data in Search Keyword with no results #10405

Closed
P-Ajay-Surya opened this issue Aug 16, 2016 · 1 comment
Closed

Not able to log data in Search Keyword with no results #10405

P-Ajay-Surya opened this issue Aug 16, 2016 · 1 comment
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@P-Ajay-Surya
Copy link

Hi
I want to log data in search keyword with no results field of site Search.
Below is my code

var searchKey = false;
if($('#backHaulEstCost').val().trim().length>0){
searchKey = true;
_paq.push(['trackSiteSearch',$('#backHaulEstCost').val().trim(),'Back Haul Est Cost']);
}
if(!searchKey){
//_paq.push([ 'trackSiteSearch', keywords + '', 0 ]);
var searchCount = 0; // set this value when rendering the search result page
paq.push(['setCustomUrl', document.URL + '&searchcount=' + searchCount]);
_paq.push(['trackPageView']);
}
Please tell me how i can log data into Search Keywords with no Result widget

@mattab
Copy link
Member

mattab commented Nov 11, 2016

Please tell me how i can log data into Search Keywords with no Result widget

you can use this method trackSiteSearch(keyword, [category], [resultsCount]) and pass the last parameter resultsCount as 0, ie. _paq.push(['trackSiteSearch',$('#backHaulEstCost').val().trim(),'Back Haul Est Cost', 0]);

@mattab mattab closed this as completed Nov 11, 2016
@mattab mattab added the answered For when a question was asked and we referred to forum or answered it. label Nov 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

2 participants