Google Analytics Site Search Config Questions - google-analytics

We have site search set up on our site, with the correct query parameter, however, we are not seeing site search data. See the image here for how our config is set up.
The URL for our search page looks like this https://www.premierinc.com/?s=Example.
We know there has been search traffic. Internal users (myself included) have performed a number of searches. The tag has been live for over a week, so processing delay shouldn't be an issue.
I've also triple checked that I'm on the correct view in GA.
Any ideas?

So it turns out that GA favors the document path (dp) parameter over the document location (dl) parameter. So although the search term was in the payload sent to GA, it was promptly ignored when it got there :)
Moral, if you use dp, you probably need to use dq as well.
(Thanks to Kim Towne on the GA forums for helping me figure this one out).

Related

WordPress custom query-string not index by Google

I have a WordPress site (www.AgingSafely.com) and on it I have built a plugin to show the “Details” about various Adult Family Homes (AFHs). All of the details are retrieved out of database table via a query-string (?asi_id=WA_Af_nnnnn) where the n’s are the AFH’s license number. I have created a “Site Map” page (https://www.agingsafely.com/asi-site-map/) that lists an overview and has links to the Details Page for each AFH, so that Google can find and link them. They are also listed in sitemap.xml.
Google isn’t indexing them, but is indexing the more normal pages on my site.
I figure that I need to change my URLs from https://www.agingsafely.com/adult-family-home/?asi_id=WA_Af_751252 to something like https://www.agingsafely.com/adult-family-home/AFH/751252 to make Google happy. To add a little more complication, The “Af” in the query string is for “Adult Family Home”. The plugin also handles “Boarding Homes” “Bf” and “Nursing Facilities” “Nf”.
How do I get the URL with the ?asi_id=WA_Af_751252 rewritten to AFH/75152
This appears to two parts: Change the links in the plugins to the /AFH/nnnn format which should be easy. Have some re-write rule that converts the new URL format back to a query string.
What is the best way to do this?
Does Google ignore query strings?
Are you planning on a lot of people entering in that particular string in a google search? Possibly some will, but probably not. If you want people to be able to easily find your products/homes via google searches, yes I would change the links to something like https://www.agingsafely.com/adult-family-home/AFH/751252. Literally spell out as much as you can, unless a string is a popular part number that people search for or something like that.
Also, is your site integrated with google analytics and google search console? I would definitely do that if you haven't.

The Google Analytics Vote For Trump Analytics Spam

We were checking newly implemented Google Analytics for our mobile app and surprisingly there are a lot of visitors from multiple countries but in actuality, we haven't released our app for any store and it's just beta between 5 main users.
After checking Google Analytics report in details we have found that it got spammed by Bot call "Trumps Bot" when something happens on your account you can see following lines in your language section.
“Secret.ɢoogle.com You are invited! Enter only with this ticket URL. Copy it. Vote for Trump!”
There are a lot of solution available to avoid this data in your reports using the filter but i was just wondering if there is any concrete solution on permanently remove this data from my reports and also is there anything we can do to avoid such data in future as its seriously affecting business strategy.
Due the tecnology used on Google Analytics the only way to eliminate this referal is using a filter, check one common point of all this hits . In this case is a hard one, because all the parameters changes , exept for the language, for a well know reason, to see the spam.
So try to use this one, in my case works
I highly recommend you read the community policy, this can be considered as off-topic question
Analytics spammers are always trying to find new ways of getting attention, and with this one, this spammer hit it big.
It is not possible to permanently remove it unless you delete the whole property. But you can create and advance segment to get a clean view.
But the most important part is blocking it so it doesn't pollutes your data. For this particular type of spam you should create a custom exclude language filter with this expression:
\s[^s]*\s|.{15,}|.|,
That expression will block any hit that doesn't use a proper language. That combined with a valid hostname filter should prevent most of the current spam and save you a lot of headaches.
If you need help, you can check this step by step guide for building these filters and creating the advanced segment to remove it from your historical data.
Here is also a related question.
Login in to Your Google Analytics account
Select ADMIN Section
Click on All Filters -- Add Filters
Give a filter name such as -- Include only website traffic
In Predefined section, select  Include Only
for more... Click Here

Capturing hash tag values in Google Analytics

We want to capture aggregated, anonymous search query history for analytic purposes to improve our internal search engine performance and metadata practices.
I found this article: https://support.google.com/analytics/answer/1012264?hl=en
Unfortunately, our search engine uses a hash tag instead of a question mark (nonstandard query string).
For example: http://www.site.com/search#q=search%20term
Is there a way to configure Google Analytics to recognize hash tag values in the URLs and capture these given a defined pattern?
Thanks
sorry to say this, but hash tags won't "make it" into the reports at all, so no search reports for hash tag.
There is a simple workaround though: use virtual pageviews, that would emulate the request with regular query parameter with ? sign.
_gaq.push(['_trackPageview', '/search?q=search%20term']);
However, this virtual pageview will generate a second pageview for a given page, which isn't preferable. So I would recommend setting up a new view specifically just for site search reports (or try to play around with advanced filters, which might get the work done). Also, don't forget to turn on the site search within the view settings as you would do otherwise:
Have you tested putting in a hash into the Query Parameter field?

Determining search query of guest user

In my app, there's a requirement to track search queries, which individuals to the app. The point here is to track specifically individuals/search_queries, i.e. I want to be able to say:
User 10.20.30.40 (IP is derived from client, ok) came to my website
from Google's search results page of 'hello world' query
Is that even possible?
I investigated the problem a bit. It turned out, that when the user on Google Search result page clicks a link and gets to the underlying page, the referer doesn't contain the search query. Say, for example, I entered a "Hello world" query...
I open google and enter a "Hello world" query;
I see a serach result page with a link to wikipedia on top; I follow it
I enter "document.referrer" in consonle to see:
http://www.google.com.ua/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CGkQFjAA&url=http%3A%2F%2Fru.wikipedia.org%2Fwiki%2FHello%2C_world!&ei=HZ0fUIXTIordtAau54GwAQ&usg=AFQjCNHSAHv8NwVNdaxMvh0OhIxs6Zb1rQ&sig2=a8tEGTBNcFWOPykloXj_Xg
There's a &q= param with a blank value, preventing me to figure out the query the user entered.
I believe Google internally uses some of the query params (i.e. ved, ei, usg or sig2) from the URL above to keep track of query used to get to the site, and thus gatehr the statistics about which queries are used mostly to the get to the website. I couldn't find any information regarding how to use them.
In the meantime, Google Analytics would only gather a general statistics, not for individuals. Yet I noticed that there's an ability to use Custom Variables. Is it possible to use them somehow in order to track query the user came with? If so, wouldn't it be a violation of Google Analytics Terms Of Service?
So again: is there a way to know a search query one came to the site with?
This is not possible. Google erases the value of q parameter, so instead of
`?q=search+query`
one always observs.
`?q=`
Though, Google provides another way (the so called convinient one) to know which queries were used to come to your website: Google Analytics.
Also, it's impossible to track user_ip/search_query pair due to Google Analytics ToS.

How to decode google gclids

Now, I realise the initial response to this is likely to be "you can't" or "use analytics", but I'll continue in the hope that someone has more insight than that.
Google adwords with "autotagging" appends a "gclid" (presumably "google click id") to link that sends you to the advertised site. It appears in the web log since it's a query parameter, and it's used by analytics to tie that visit to the ad/campaign.
What I would like to do is to extract any useful information from the gclid in order to do our own analysis on our traffic. The reasons for this are:
Stats are imperfect, but if we are collating them, we know exactly what assumptions we have made, and how they were calculated.
We can tie the data to the rest of our data and produce far more accurate stats wrt conversion rate.
We don't have to rely on javascript for conversions.
Now it is clear that the gclid is base64 encoded (or some close variant), and some parts of it vary more than others. Beyond that, I haven't been able to determine what any of it relates to.
Does anybody have any insight into how I might approach decoding this, or has anybody already related gclids back to compaigns or even accounts?
I have spoken to a couple of people at google, and despite their "don't be evil" motto, they were completely unwilling to discuss the possibility of divulging this information, even under an NDA. It seems they like the monopoly they have over our web stats.
By far the easiest solution is to manually tag your links with Google Analytics campaign tracking parameters (utm_source, utm_campaign, utm_medium, etc.) and then pull out that data.
The gclid is dependent on more than just the adwords account/campaign/etc. If you click on the same adwords ad twice, it could give you different gclids, because there's all sorts of session and cost data associated with that particular click as well.
Gclid is probably not 100% random, true, but I'd be very surprised and concerned if it were possible to extract all your Adwords data from that number. That would be a HUGE security flaw (i.e. an arbitrary user could view your Adwords data). More likely, a pseudo-random gclid is generated with every impression, and if that ad is clicked on, the gclid is logged in Adwords (otherwise it's thrown out). Analytics then uses that number to reconcile the data with Adwords after the fact. Other than that, there's no intrinsic value in the gclid number itself.
In regards to your last point, attempting to crack or reverse-engineer this information is explicitly forbidden in both the Google Analytics and Google Adwords Terms of Service, and is grounds for a permanent ban. Additionally, the TOS that you agreed to when signing up for these services says that it is not your data to use in any way you feel like. Google is providing a free service, so there are strings attached. If you don't like not having complete control over your data, then there are plenty of other solutions out there. However, you will pay a premium for that kind of control.
Google makes nearly all their money from selling ads. Adwords is their biggest money-making product. They're not going to give you confidential information about how it works. They don't know who you are, or what you're going to do with that information. It doesn't matter if you sign an NDA and they have legal recourse to sue you; if you give away that information to a competitor, your life isn't worth enough to pay back the money you will have lost them.
Sorry to break it to you, but "Don't be Evil" or not, Google is a business, not a charity. They didn't become one of the most successful companies in the world by giving away their search algorithm to the first guy who asked for it.
The gclid parameter is encoded in Protocol Buffers, and then in a variant of Base64.
See this guide to decoding the gclid and interpreting it, including an (Apache-licensed) PHP function you can use.
There are basically 3 parameters encoded inside it, one of which is a timestamp. The other 2 as yet are not known.
As far as understanding what these other parameters mean—it may be helpful to compare it to the ei parameter, which is encoded in an extremely similar way (basically Protocol Buffers with the keys stripped out). The ei parameter also has a timestamp, with what seem to be microseconds, and 2 other integers.
FYI, I just posted a quick analysis of some glcid data from my sites on this post. There definitely is some structure to the gclid, but it is difficult to decipher.
I think you can get all the goodies linked to the gclid via google's adword api. Specifically, you can query the click performance report.
https://developers.google.com/adwords/api/docs/appendix/reports#click
I've been working on this problem at our company as well. We'd like to be able to get a better sense of what our AdWords are doing but we're frustrated with limitations in Analytics.
Our current solution is to look in the Apache access logs for GET requests using the regex:
.*[?&]gclid=([^$&]*)
If that exists, then we look at the referer string to get the keyword:
.*[?&]q=([^$&]*).*
An alternative option is to change your Apache web log to start logging the __utmz cookie that google sets, which should have a piece for the keyword in utmctr. Google __utmz cookie and you should be able to find plenty of information.
How accurate is the referer string? Not 100%. Firewalls and security appliances will strip it out. But parsing it out yourself does give you more flexibility than Google Analytics. It would be a great feature to send the gclid to AdWords and get data back, but that feature does not look like it's available.
EDIT: Since I wrote this we've also created our own tags that are appended to each destination url as a request parameter. Each tag is just an md5 hash of the text, ad group, and campaign name. We grab it using regex from the access log and look it up in a SQL database.
This is a non-programmatic way to decode the GCLID parameter. Chances are you are simply trying to figure out the campaign, ad group, keyword, placement, ad that drove the click and conversion. To do this, you can upload the GCLID into AdWords as a separate conversion type and then segment by conversion type to drill down to the criteria that triggered the conversion. These steps:
In AdWords UI, go to Tools->Conversions->Add conversion with source "Import from clicks"
Visit the AdWords help topic about importing conversions https://support.google.com/adwords/answer/7014069 and create a bulk load file with your GCLID values, assigning the conversions to you new "Import from clicks" conversion type
Upload the conversions into AdWords in Tools->Conversions->Conversion actions (Uploads) on left navigation
Go to campaigns tab, Segment->Conversions->Conversion name
Find your new conversion name in the segment list, this is where the conversion came from. Continue this same process on the ad groups and keywords tab until you know the GCLID originating criteria
Well, this is no answer, but the approach is similar to how you'd tackle any cryptography problem.
Possibility 1: They're just random, in which case, you're screwed. This is analogous to a one-time pad.
Possibility 2: They "mean" something. In that case, you have to control the environment.
Get a good database of them. Find gclids for your site, and others. Record all times that all clicks occur, and any other potentially useful data
Get cracking! As you have started already, start regressing your collected data against your known, and see if you can find patterns used decrypting techniques
Start scraping random gclid's, and see where they take you.
I wouldn't hold high hope for this to be successful though, but I do wish you luck!
Looks like my rep is weak, so I'll just post another answer rather than a comment.
This is not an answer, clearly. Just voicing some thoughts.
When you enable auto tagging in Adwords, the gclid params are not added to the destination URLs. Rather they are appended to the destination URLs at run time by the Google click tracking servers. So, one of two things is happening:
The click servers are storing the gclid along with Adwords entity identifiers so that Analytics can later look them up.
The gclid has the entity identifiers encoded in some way so that Analytics can decode them.
From a performance perspective it seems unlikely that Google would implement anything like option 1. Forcing Analytics to "join" the gclid to Adwords IDs seems exceptionally inefficient at scale.
A different approach is to simply look at the referrer data which will at least provide the keyword which was searched.
Here's a thought: Is there a chance the gclid is simply a crytographic hash, a la bit.ly or some other URL shortener?
In which case the contents of the hashed text would be written to a database, and replaced with a unique id.
Afterall, the gclid is shortening a bunch of otherwise long text.
Takes this example:
www.example.com?utm_source=google&utm_medium=cpc
Is converted to this:
www.example.com?gclid=XDF
just like a URL shortener.
One would need a substitution cipher in order to reverse engineer the cryptographic hash... not as easy task: https://crypto.stackexchange.com/questions/300/reverse-engineering-a-hash
Maybe some deep digging into logs, looking for patterns, etc...
I agree with Ophir and Chris. My feeling is that it is purely a serial number / unique click ID, which only opens up its secrets when the Analytics and Adwords systems talk to each other behind the scenes.
Knowing this, I'd recommend looking at the referring URL and pulling as much as possible from this to use in your back end click tracking setup.
For example, I live in NZ, and am using Firefox. This is a search from the Firefox Google toolbar for "stack overflow":
http://www.google.co.nz/search?q=stack+overflow&ie=utf-8&oe=utf-8&aq=t&client=firefox-a&rlz=1R1GGLL_en-GB
You can see that: a) im using .NZ domain, b) my keyword "stack+overflow", c) im running firefox.
Finally, if you also stash the full landing page URL, you can store the GCLID, which will tell you the visitor came from paid, whereas if it doesn't have a GCLID, then the user must have come from natural search (if URL tagging is enabled of course).
This would theoretically allow you to then search for the keyword in your campaign, and figure out which adgroup them came from. Knowing the creative would probably be impossible though, unless you split test your landing URLs or tag them somehow.

Resources