Output search keywords without having to duplicate code
Hello,
I'm trying to send my keyword searches to Google analytics using low search. However, I have to do the following (repeat the script in two if statements). The issue seems to be that I have to send the keywords based on whether there is a result and also when there is not a result. Is there a better way to do this so that I don't have to repeat myself?
-----------------------------------------
{exp:low_search:results query="{segment_3}"}
{if count == 1}
{/if}
{if no_results}
{/if}
{/exp:low_search:results}
Replies
Susan Swallow Ohtake 30 Nov 2013 04:00
Looks like getsatisfaction stripped out the JavaScript that was in between my "if" statements. Anyway, doesn't really matter - it's the same exact script in both "if" blocks, hence the problem.
Low 30 Nov 2013 08:58
You could get the code out of the Results tag and use the Keywords tag instead.
Susan Swallow Ohtake 30 Nov 2013 19:53
Perfect, thank you!