Use Google Analytics custom events for feedback form - javascript

I was thinking of having a simple feedback form in my website.
It would be something like:
Your Feedback will help us improve.
[ ]
and then a textfield/textarea where the user can type (let's say) up to 100 characters of feedback.
Rather than handling it all myself on the server-side I was thinking to use Google Analytics (since my site is already wireup) and every time a user writes a comment, send a custom event to google analytics.
I think it might work.
Can people suggest a better approach or point out any problem with this idea?

There are a few problems with this.
First of all, it's against the Google Analytics Terms of Service to pass personally identifiable information to Google Analytics (#7). So, if you were to want to collect their feedback, you legally could not collect their name or email address without risking your account getting shutdown by Google.
Second, this is not at all what Google Analytics is for; its for collecting aggregate traffic and site interaction data. There's no easy-to-use interface for viewing long-form text information; I'm not even sure how you'd view event information thats longer than a few words.
Finally, Google Analytics sends its information in URLs, and there are size limitations to URLs (in Internet Explorer), and so Google Analytics will be default truncate any request with more than 2048 characters, meaning that your data will not collect accurately for longer feedback forms. (EDIT: Google Analytics recently raised this cap to 8096, by configuring the requests to use POST when >2048 characters.)
There are lots of free and easy to use data and form collection tools. Google Docs, for example, connected with Google Forms, can collect this data for you with ease. Then there's Wufoo, SurveyMonkey, UserVoice...I could go on forever.
Don't use Google Analytics for this. It's a bad idea with no upside.

Google Analytics events weren't made for gathering user feedback. Aside from the impracticalities of using the analytics console to view feedback, GA uses JSON to pass event information (which has size restrictions).
Why not try out uservoice.com or suggestionbox.com?

Related

How Google's reCAPTCHA v3 works

Google has rolled out reCAPTCHA v3. It does away with all the user friction. I wish to use it to secure my site. However, I am unsure about how this is going to protect my site. What if a hacker spams the URLs on my site with an external tool without using the interface I provide? How is reCAPTCHA v3 going to stop that?
How is reCAPTCHA v3 going to stop [Spam] ?
There are various heuristics which can be used to detect automated systems, such as the number of requests coming from a certain IP, browser fingerprinting, Google account cookies, among many others. Google seems to use some of them. If uncertain, a challenge gets shown.
What if a hacker spams the URLs on my site with an external tool without using the interface I provide?
Google generates a token for the client when they pass the checks which you have to validate on the serverside. If someone doesn't pass the CAPTCHA (a robot), they do not have a token.
In addition to the user behavior tracking on your site (as explained by Jonas Wilms), the v3 (and v2) also makes decisions based on your IP, ASN, browser and any kind of information about your system based on the information sent via your HTTP request.
The only difference is that V2 is a complete solution i.e, if it thinks a user may be a bot, it will pose additional challenges until it is convinced the user is a human. On the other hand, V3 is non-intrusive. It generates a score based on the parameters discussed above and passes it onto you. It is then your decision to take appropriate steps (like post challenges, or have two-factor authentication, etc.) based on this score.
IMO, it is better to start with a V2 solution and implement V3 if you want more control or have a better way to challenge the user if they have a low score.
(Here is an interesting article on the differences)
In few simple words google tracks your whole cursor and keyboard movement from moving mouse to select form fields to pressing tab to change fields.
To verify reCAPTCHA is working or not --> Submit a form and then
click refresh; it would ask for re-submission. Click continue. But as
this is a way much similar to Robot activity of submitting a form without any cursor of keyboard movements, reCAPTCHA will prevent
form submission or any other stuff from happenning.

Cross-domain conversion tracking - Custom vs GA?

Say I'm starting a site, refer.com, where I post items on an 'affiliation' basis. When users click on my links, they're directed to the site shop.com. If the user I redirect to shop.com makes a purchase, I need that conversion tracked.
I see two possibilities:
Creating a custom tracking library (probably JavaScript) where I
request URLs from refer.com to transfer information from shop.com. I guess PHP would work too, but reduces compatibility with clients.
I use Google Analytics cross-domain tracking to do this. I don't
want the refer.com GA account to interfere with the shop.com GA account, but as I understand it you can use several accounts on the
same page, giving them different identifiers.
I feel like I'm stuck with a narrow set of possibilities. Do I do both? Neither? I need it to be as easy to implement as possible for the client, while also providing relatively bullet proof tracking. What's the standard today? Affiliation services are everywhere, and this type of cross-domain tracking has to be a very used technique. Is there another preferred method of achieving this that I'm not aware of?
This question might seem highly theoretical. While that may be true, answers with code are highly appreciated too.
I have a way for this to work but it requires both your domains to have the Universal Analytics code installed. This will not work with the older GA code
https://support.google.com/analytics/answer/1032400?hl=en
You can install multiple instances of the Google Analytics tracking code on your web pages to send data to multiple properties in your account.
You can, for example, install multiple instances of the Universal Analytics tracking code (analytics.js) on your web pages but only one instance of the Classic Analytics code (ga.js).
So (provided they have your GA code installed) when you refer to shop.com what you should do is this
Parse your GA cookie. You can get to it by $_COOKIE['_ga']. The cookie holds a string that has four parts, broken up by periods. (i.e. GA1.3.367110421.1357220305). You want those last 2 numbers (in this example 367110421.1357220305)
Pass the parsed cookie data in your referral to shop.com
shop.com should store the parsed cookie in its session
Last but not least, when shop.com has your referral data it should load your GA code and set your sessions up like this
ga('create', 'UA-YOUR-GA-CODE', {'cookieDomain': 'shop.com', 'clientId': 'USERS-PARSED-SESSION'});
What this does is it passes your GA session to their domain. At this point, GA will keep their session going so you can track what happens on shop.com. Any conversion data they pass to their GA code should be passed to your GA as well.
Is it bulletproof? No. You have to trust shop.com to properly retain and show your referrred GA session ID. But I have to use this methodology to keep my sessions between my primary sites and the centralized checkout we use and it preserves my Adwords conversions, etc.
I feel like if you're looking for ease of use for the client, Google Analytics is a pretty solid option. It is a widely used tool, with lots of documentation and active forums for feedback. Also, from my research on the topicit seems that they've got this type of behaviour in mind already.
An alternate that comes to mind is that, when redirected from site A to site B, they should be forced to authenticate on site B. You could then setup an authentication form that is unique to this referral from site A, and will be filtered into your database separately from regular authentications on site B.

Can I associate a user's account with an action to the drive API?

We're looking to make a little webapp to manage our week-long nerf war (humans vs zombies to be precise), and we're thinking about how easy it would be to have Google Sheets be our only backend, and our frontend be entirely javascript/html/css.
Let's say there's two actions that can be done in this javascript:
Register, which adds a row to a certain sheet.
Report tag, which adds a row to another sheet.
Let's say we have 100 players. We'll have each player sign in using a google account. Is there a way that for either of those above actions, we can have sheets know who made that action?
This way, if someone gets hold of the API key and spoofs their referer to make bad requests, then we can know which google account did it and ban them from the game.
For example, if I open up my sheet and say "see revision history", I want to not see one user for all the revisions, I want to see the user who triggered the action.
Is this a reasonable approach, and is it possible? Thanks!
(note: i know these two actions can be done via google forms, which can associate the user's account, but imagine we have more complex actions that cant be achieved with just a google form)
The short answer is no. You'll be using the spreadsheets API (NOT the Drive API) to update the sheet.As far as Google is concerned, the "user" is your application, regardless of which human was driving the application at the time. Your application knows who the human is, and so it is responsible for logging any audit info that your use case may require.

How to disable Google Analytics pageviews tracking but keep event tracking?

I have a WordPress plugin which bloggers can opt-in for tracking. The data is used to improve the UX in yhe plugin's management dashboard settings pages.
Since we are only interested to track some button click events and don't really need the "pageviews" tracking, is there any way to tell Google to disable the pageviews tracking? I want to respect the publishers privacy as much as I can, and if there's no reason to track pageviews I would prefer to block it.
Disable pageview tracking
The default behavior of this snippet is to send a pageview hit to Google Analytics. This is the desired behavior in most cases; pageviews are automatically tracked once you add the snippet to each page on your site. However, if you don’t want the snippet to send a pageview hit to Google Analytics, set the send_page_view parameter to false:
gtag('config', 'GA_TRACKING_ID', { 'send_page_view': false });
From :https://developers.google.com/analytics/devguides/collection/gtagjs/#disable_page_view_tracking
You could do this with the Measurement Protocol directly. The Measurement protocol is just some HTTP posts or gets that send the data directly to your Google Analytics account. The JavaScript code that you get from Google basically does just that.
It is a little tricky there are some required fields you have to send or the data wont record correctly. But if all you want to be able to do is track some button clicks sending the events along shouldn't be to hard.
This is untested example:
http://www.google-analytics.com/collect?v=1&tid=UA-XXX-Y&cid=35009a79-1a05-49d7-b876-2b884d0f825b&t=event&ec=file&ea=upload&userclicked&ev=1
CID just needs to be a session id some way of knowing one user session from another.
NOTE: This will not record all of the normal data. you are going to loose things like language, location, pagepath. This is probably only going to store the event nothing else. I would consider putting it in its own web property to keep the data separate from any true Google Analytics recorded data.

Is it possible to use the Google Analytics API to provide stats for customer's page views?

Let's say I run a site where customers are willing to pay for a page that shows some sort of cool info about them. The whole site is tracked using Google Analytics.
To provide stat tracking for the customers, would it be possible to mine the data from Google Analytics, using the AJAX API?
Are there any show-stoppers I should look out for before attempting this?
Trying to prevent from writing my own stat tracking solution.
Update, a bit more clarification: I'm looking to be able to build a stats page that shows a few stats for a specific url (page views, traffic sources, etc...), not necessarily in real-time. I would cache the page to prevent hitting API rate limits.
There are 2 major impediments: One technological, and one legal-ish. Together, they make using Google Analytics Data Export API an unfit solution.
Technological: Google Analytics Data is not available in Real-Time. Delays in data processing run from 3-4 hours to 24-48 hours. Page-views are processed fasted; things like custom variables often take a day or so). In theory, you could tag each user with a custom variable, and then query against that custom variable for information.
Legal-ish The Google Analytics Terms of Service prohibits you from collecting personally identifiable information. So, you can't use a custom variable that stores their username on your site without violating the Terms of Service. Here's the relevant section.
PRIVACY . You will not (and will not allow any third party to) use the
Service to track or collect personally
identifiable information of Internet
users, nor will You (or will You allow
any third party to) associate any data
gathered from Your website(s) (or such
third parties' website(s)) with any
personally identifying information
from any source as part of Your use
(or such third parties' use) of the
Service. You will have and abide by an
appropriate privacy policy and will
comply with all applicable laws
relating to the collection of
information from visitors to Your
websites. You must post a privacy
policy and that policy must provide
notice of your use of a cookie that
collects anonymous traffic data.
As far as alternatives, it depends on what information you want. You can access their IP address on the server side and use that with a third party tool or a command line call to find out their rough location (much the same way that Google does). You can similarly access their referer on the server side. Much of the information that gets sent to Google actually gets stored in the Analytics cookies (_utm prefixed cookies). There's a wide body of literature on reading these cookies (See: http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=how+to+parse+google+analytics+cookies)

Categories

Resources