: Tie multiple values to an event in Google Analytics I have a search form with several fields - 1 or all of them may be used. I also have an outbound link on the search results that trigger
I have a search form with several fields - 1 or all of them may be used. I also have an outbound link on the search results that trigger an event. What I am trying to do is determine how many of each search term is used in some way that resulted in a click to each of these outbound link events.
For example, let's say that I have the following searches, both which result in a click event on OutboundLink A
Search 1
FirstName: John
LastName: Smith
ZipCode: 90210
Search 2
LastName: Smith
State: California
I would want something that aggregated the search terms that came before that outbound click event like this:
John: 1
Smith: 2
90210: 1
California: 1
I can try to figure out a way to track this server-side, but I was hoping that I would be able to do this with Google Analytics.
More posts by @Ann8826881
1 Comments
Sorted by latest first Latest Oldest Best
Event parameters are plain text, so you can set whatever you want. Just keep in mind you must follow a convention (defined by yourself) for what you concatenate and how you sort that data, this way your data will be consistent.
The way you want to view your data in Events Report can be accomplished only if you set every single search criteria into one of the parameters of an event and fire an event for each one. As I said before, you can set whatever you want in your parameters, but it's better to stay close to convention, so, maybe the parameter that best fits for this is Label. The simplest thing to do could be something like this:
_trackEvent('whatever-category', 'whatever-action', 'smith');
_trackEvent('whatever-category', 'whatever-action', 'john');
_trackEvent('whatever-category', 'whatever-action', '90210');
Asynchronous version:
_gaq.push(['_trackEvent', 'whatever-category', 'whatever-action', 'smith']);
Universal Analytics version:
ga('send', 'event', 'whatever-category', 'whatever-action', 'smith');
In your current implementation, supposing you are already using Category, Action, Label, maybe you have something like this:
_trackEvent('outboundlink', 'click', 'url-clicked-by-visitor');
Trying to add something else to any of these parameters will result in data split, and I think that's not a good idea.
Abusing a little bit of event parameters you could track every search criteria and relate it to the outbound link clicked:
_trackEvent('outboundlink', 'click', 'url-clicked-by-visitor');
_trackEvent('searchcriteria', 'url-clicked-by-visitor', 'smith');
_trackEvent('searchcriteria', 'url-clicked-by-visitor', 'john');
_trackEvent('searchcriteria', 'url-clicked-by-visitor', '90210');
Because URL's will be too many, I'll prefer to set them as Action, and set just one Category for keeping all of them grouped. Also you could set your search criteria as Action and URL as Label.
Parameter Action should indicate some kind of user interaction, but, I guess it's up to the webmaster set whatever makes sense. Anyway, this is not a best practice, but it'll work.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.