Google Analytics (Internet Marketing - Tracking website - Query Parameter) - google-analytics

If there is no query parameter in the url of search bar results and I want to track inside google analytics what guests search inside Search bar on my website then I need to add the following code inside the GA tracking code:
pageTracker._trackPageview("/searchresults.html?q=$keyword");
but how to translate it into new version of tracking code? with gaq word.
Also whoever would be willing to answer please say if I have to change $keyword or keyword with anything else or can I type EXACTLY this?
Also please say where exactly, inside google analytics tracking code, do I need to paste the code line? Probably somewhere around word var but don't know where...

Simply use:
_gaq.push(['_trackPageview','/searchresults.html?q=$keyword']);
it can be anywhere in your page, it should replace the default
_gaq.push(['_trackPageview']);
call
You will need to have server side code (PHP, ASP, ...) fill in the value for $keyword.
Next, you will need to enable search term parsing in your GA Profile(s) settings.
Beware to use a parameter name ('q' here) that isn't used for other purpose in your site, elese every URL logged to GA and containing this parameter will be parsed as search query and the value will be considered as a keyword.

Related

Adding Google's standard search (not custom) to my website

My intention is to embed Google results in my website. I don't want to customise the domain/s on which the search is performed or anything, just a 'bog standard' Google search based on search parameters I pass it.
2 questions:
How do I display google results on my website as a response to search criteria entered into a textbox I have?
Is there any legislation I need to take into account?
I know my second question sounds rather strange but I'm aware that what I'm appearing to do here is present content driven by Google as though it's my own so want to avoid breaching any copyright or 'same-origin policy' type thing.
What I've Tried/Ways I Know I Could Achieve This
Screen scraping Google's response to a simple web request with the necessary query parameters (but seems a bit excessive)
Google's custom search (but I don't want to customise anything)
I've tagged this question for some more context.
As it is mentioned here
you can use your own XML parser to customize the display for your
search users.
with an http request like this:
GET /search?q=bill+material&output=xml&client=test&site=operations
But it has a limitation on number of requests per day, 500 or 1000 I guess.
Custom Search can be configured to include the entire Web in its results:
From the Google Custom Search homepage, click New search engine.
In the Sites to Search box, enter at least one valid URL (e.g. www.google.com).
Click Create.
On the next page, under Optional next steps, click Edit.
On the Basics tab, under Search Preferences, select Search the entire web but emphasize included sites.
Click Save Changes.
In the left-hand menu, under Control Panel, click Sites.
Delete the site you entered during the initial setup process.

Why do my Google Analytics URLs begin with slashes?

When looking at Google Analytics, all reports show URLs that begin with a slash and www: "/www.url.com/page.html."
I've never seen Google report like this. Webmaster Tools is set up correctly. Not sure what else can be set up in Analytics. Any idea?
Current: /www.url.com/page.html
Typical: /page.html
by default GA only reports the relative path and query string of the URL (it strips the protocol and domain. So one of two things must be happening:
1) you have code that is passing a custom page name to the _trackPageview call, adding that "/[domain]".
2) you have a custom filter within the interface setup that is prefixing the page name with "/[domain]"
Adding the domain to the page name is a fairly common thing to do when you have GA code spanning multiple domains, most especially when they are going to a rollup profile, so that you can see which pages are coming from which domain.
So if I had to guess (and this is only a guess, seeing as how I don't have access to your
code or GA interface), someone must have attempted to rebuild the full url to use as the page name instead of just the path+querystring - and then messed up (probably a messup in some regex with the protocol, if I wanted to throw even more guesses at it).
But the 64 thousand dollar question is.. where is it being changed? Like I said.. GA by default does not do this, so someone has added code to do it on your site, or else a filter within the interface.
I would start by looking to see if there are any filters in your interface, since that is the easier thing to determine. If you see no filters relevant to this, then you will have to look on your page code (including any script includes or other javascript code being output). It would be a value passed with _trackPageview so ctrl+f for that.

Tracking email clicks with tagged links (could be google analytics or custom)

I'm trying to track a series of emails and where users are clicking. I really only have google analytics to work with. I'm attempting to use google analytics to tag my links but all I'm getting is the campaign, all the other tags are coming up (not set).
example of the links I am using:
http://www.example.com/en/secured/rewards?entity_id=<%~user%>&pw=<%~pw%>&utm_source=confirmEmail1&utm_medium=email&utm_content=button1&utm_campaign=ssconfirmEmail1
This part of the link HAS to be there.
http://www.example.com/en/secured/rewards?entity_id=<%~user%>&pw=<%~pw%>
I believe something with the entity_id and pw tags are creating a conflict with google's tags. Currently I'm testing weather doing this to the link will work or not.
http://www.example.com/en/secured/rewards?utm_source=confirmEmail1&utm_medium=email&utm_content=button1&utm_campaign=ssconfirmEmail1&entity_id=<%~user%>&pw=<%~pw%>
My question is, first: Does anyone know a reason why this would be happening?
second (forget google analytics and do something custom): I know I could track the link by creating a redirect through a page and then having it redirect to the correct url, but I'm too new at this to know if I can carry the entity_id and pw through the redirect. If so, how?
Thanks!
Since the link was picking up everything but the content, I just eliminated that and changed the source to what I was using in the content. It's working now
http://www.example.com/en/secured/rewards?entity_id=<%~user%>&pw=<%~pw%>&utm_source=button1&utm_medium=email&utm_campaign=ssconfirmEmail1

jquery address and preventing google analytics tracking?

How would I go about preventing the tracking of hash path changes within google analytics while using the jquery address plugin?
original URL:
/?watch
When moving sliders on the page, address bar is appended:
/?watch#/204;276
Within analytics I'm seeing it tracked as unique page views like so:
/?watch/204;276
I'm just wanting it to be tracked as:
/?watch
Help much appreciated.
You could use a custom search and replace filter with a regular expression in the search string.
Before setting up any filters, make a "master" profile in GA that contains unfiltered data. That way if your filter affects your data negatively, you have all your data unfiltered and backed up.
The regular expression I used is ^/\?watch[/0-9;]+ You can test it at RegExPlanet. I didn't put the hash (#) symbol in the regex because, according to your question, GA is not tracking it in the request URI.

Redirecting search results into an ASP.NET page

I've an ASP.NET page with a textbox and a option from user of the following choices: Wikipedia, Google, Dictionary.com, Flickr, Google images.
The user enters a word(s) in the textbox and selects a choice among the following.
Depending on the choice select by the user I wish to return the following.
Wikipedia: Return the content and link to the page corresponding to the topic about the word.
Google: Return the top 10 results of google search for this word.
Flickr: Return a few images atmost 10 images from flickr search
GoogleImage: Return a few images from google image search.
Dictionary: Return the meaning of the word.
How can I do that?
Since you are wanting to do some processing on the results prior to displaying them, your best bet is probably to invoke a web request on the server to fetch your results as RSS or some other parsable XML format.
So first up, we have Wikipedia, which has API support for open search, and queries with XML or JSON output. You can get the details of the API by going to: http://en.wikipedia.org/w/api.php
I would think either the query action, or opensearch action would be what you want.
Right, now there is Google, which supports search results as RSS through their Active Search feature. The link takes you to the main page where you can build the query, at which point it should be easy to drop in your search terms. There is also the Google Search AJAX API, which you can find out about here (See the "Flash and other Non-Javascript Environments" section for building the URLs directly. I believe this option should give you access to Google Image results as well.
For Flickr, have a look at this App Garden page. There are several output formats available to choose from.
I wasn't able to find anything real solid on getting results from Dictionary.com, but it does appear that they have an API. You might be able to dig through google and find some references on how to get search results as XML or JSON. There are also several other Dictionary sites which may have more information about their APIs. While searching I managed to find this SO question about word lookup from google dictionary.
Hope this helps.
Have an iframe within your page, and then set the src of the frame to the appropriate query string that you craft from the user's input.
This can be done from javascript within the page, in response to the user selecting something in the 'choice' dropdown. You can have the appropriate urls already embedded in the javascript (as variables), and just substitute in the user's input.

Resources