Google CSE(Custom Search Engine) how set query to GA(Google Analytics) - google-analytics

I use google cse as my site search.
Google support page: support.google.com/analytics/answer/1012264
Take this example: www.google.com?hl=en&q=xxx. So the Query Parameter is q. And my site is with google cse, the query action will direct to url like this: https://cse.google.com/cse?cx=xxx&q=xxx...#gsc.tab=0&gsc.q=%23C&gsc.page=1
My Google Analytics report cannot get query words from this case.
Google Analytics can get the word only on directly enter the url like this http://site?q=xxx.
But I use google cse instead of myself site's search.
How can I set the correct settings ?
Thanks!

I have been having a similar problem and I think you must be using:
<gcse:searchbox-only> and <gcse:searchresults-only>
If you are then you have to customise the javascript code segment with the resultsURL element.
resultsUrl URL The URL of the results page. (Default is the Google-hosted page.)
From Custom Search Element Control API.
<gcse:searchbox-only resultsUrl="http://www.yourWeb.com"></gcse:searchbox-only>

Related

GA query parameters breaking link

I'm working on this site k-west.co.uk - if you go to the footer and click the link to Twitter you'll find it doesn't work. Google Analytics has added utm parameters and it seems this breaks Twitter. If you remove the paramters from the url, Twitter works.
How can I tell Google Analytics not to add query parameters to this link? Is there a class or attribute I can add that will do this?
I tried to remove the parameters using JavaScript but as GA only adds the parameters as you click the button, I cannot remove them, I need to prevent GA adding them in the first place.
Thanks
It looks that you're using Google Tag Manager to add Google Analytics functionality to your site and cross-domain tracking is enabled for Analytics tag. But it looks misconfigured as #vinoaj suggested. You need to modify your Google Analytics settings variable to only add cross-domain parameters to the links to target site:
While Auto Links Domain field is blank all the links will be extended with cross-domain tracking parameters.

google analytics for blog page views using google tag mananger

I want to track the pageviews of my blogs in google analytics. I have created a tag and created variable with UA string - tracking ID and tried to trigger on regex
/https:\/\/([^"\/]*\/)*blog\/([^"]*)/
containing blog but the count dosen't increase in google analytics.
You can use Page Path variable and set trigger like that:
Page Path - matches RegEx (ignore case) - ^/blog/.*

Escape a Shebang /#!/ in URL for Google URL Builder

Does anyone know if/how I can escape the shebang or encode the uri to make a link work properly in google analytics url builder? I want to add campaign parameters to product page urls to track ads success. The url for each individual product page looks like this:
http://www.oursite.com/classic-movies/#!/Title-of-Movie/p/12345678
When I put the product page url into the url builder, it says the url is invalid. I think it is because of the #!. I have tried escaping out the special characters, replacing the shebang with %23%21 or %21!
It appears valid in the url builder, and the builder generates a link with utm tags, BUT when you paste the tagged link into the browser, it does not take you to our product page. It takes you to our website, but gives a "sorry does not exist" message.
I also tried this:
http://www.oursite.com/classic-movies/?_escaped_fragment_=/Title-of-Movie/p/12345678
It generates a link in the builder and does link to the product page of our website (yay!), but the url adds this after the campaign name: #!/Title-of-Movie/p/1234567
The shebang is back! Will that be a problem?
For reference, we're using the Ecwid storefront plugin for a wordpress site.
Thanks in advance.
Short answer
You should use the URL without fragment (hash part) as a base for building URLs with queries (the part starting with '?') and then append the hash part to the end of URL.
Example:
1) Take http://www.example.com/classic-movies/#!/Title-of-Movie/p/12345678
2) Remove hash part: http://www.example.com/classic-movies/
3) Use this hash-free URL as a base and add query parameters yourself or use any automatic builder. Example: http://www.example.com/classic-movies/?utm_source=myblog&utm_campaign=xyz&abc=def
4) Append the hash part to the end of the URL: http://www.example.com/classic-movies/?utm_source=myblog&utm_campaign=xyz&abc=def#!/Title-of-Movie/p/12345678
You're done – the final URL is valid URL which will work fine for browser/customer, your site server and tracking tools like Google Analytics
Long answer
1) URLs could be very different, but their structure is actually quite the same and that's a part of the web standards.
URL is built this way:
protocol://site/path?query#fragment
(I simplified it and take in consideration only the parts we're talking about, the actual scheme is a bit more complicated)
Taking your product page URL, that will be:
protocol: http
site: www.example.com
path: classic-movies/
query: (empty)
fragment: !/Title-of-Movie/p/12345678
Now, if you want to add query parameters, you know where to insert them. As to the fragment part, it should be always in the end, regardless of whether it contains !
2) Google Analytics doesn't track the fragment parts of the URLs.
Urls like http://www.example.com/coolpage and http://www.example.com/coolpage#!anyparameter=anyvalue are the same for Goolgle Analytics. That's likely the reason why their URL builder tool doesn't accept that.
By the way, Ecwid uses fragment part of the URL all the time to address the product and category pages, but that's not an issue if you want to track your product pages in Google Analytics. Ecwid solved that problem by sending special 'virtual' page views to Google Analytics every time a customer browses your store. So in your GA reports you will see your store pages.
3) If you use Google Adwords for your ad campaigns, I'd suggest linking your Google Analytics and Google Adwords profiles to have better picture of customer behavior and the campaign performance. Check out this thread on Ecwid forums for the details:
http://www.ecwid.com/forums/showthread.php?t=10835

How to get full url of referring links

Assume there a page containing a link to my site and the url for this referring page was this:
http://source.com/referral_path/topic.php?t=123
In google analytics it would display as this:
ga:source: source.com
ga:referral_path: /referral_path/topic.php
I recall long ago there was a switch/setting which would control whether the t=123 (i.e. query parameters) would be included as part of the referral_path or not. Is this correct? And if it is how do I control it.
The only setting GA has for query parameters is the search query params. Setting Up Site Search for a Profile
For the full URL you still should apply a filter.
View Full Page URL In Reports
Also see: Full referrer URL in Google Analytics reports

Multiple links pointing to the same location. Track which one was clicked using Google Analytics

I'm trying to get Google Analytics to track the specific link in the page that was used by the users to get to a specific location.
Say I have links poing to the contact page from the main menu, the page's contents and the footer.
Looking at what other websites are doing, I've added references inside GET parameters for each of the links like so: http://www.example.com/contact?ref=menu , http://www.example.com/contact?ref=content and http://www.example.com/contact?ref=footer . I've also added the ref parameter to the ignore list inside Google Analytics so the three URLs are not tracked as separate pages.
My question now is: How sould I go about tracking which one was used to get to the contact page?
Although the post is a bit old, for others like me finding this via search, here is the solution. Enhanced Link Attribution in Google Analytics.
http://support.google.com/analytics/bin/answer.py?hl=en&answer=2558867
Sounds like you are already tracking them with the URL param.
If Google Analytics is successfully tracking them as separate pageviews with the ref= URL param, then you could create a custom report in GA that shows the number of pageviews. The custom report can be added to your dashboard for quick reference.
The custom report can be set up like this:
Metric groups: pageviews
Dimension drilldowns: page
Filters: include -> Page -> regex -> /contact\?ref=(content|menu|footer)
Or, for each click, add the following to each link:
Contact
Contact
Repeat for each link. This is no more work than adding a ref= to each link.

Resources