I try to get some information about the bandwidth of my users. Currently im running NetworkInformation/downlink in Google Tag Manager and pushing it to Google Analytics
https://wicg.github.io/netinfo/#downlink-attribute
https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation/downlink
Why is there no value higher than 10 Mbit... this looks unrealistic to me? Also having the majority at exactly 10 Mbit downlink seem weird. Is there a limit at 10 Mbit?
Custom Javascript in GTM looks like this:
function () {
var con = navigator.connection || navigator.mozConnection || navigator.webkitConnetion
return Number(con.downlink);
}
As mentioned on the documentation, that's probably because your users are using a Chrome based navigator (or because all navigator implemented this cap since published)
So the speed indicator is capped to a maximum of 10Mpbs
Related
On a wordpress website we are showing some video's on product pages.
Without any regularity there is a "video not available" message. I was hoping we could get some help figuring out any way this is possible. Below is the error we are getting, which doesnt provide a lot of inofrmation.
I already kind of ruled out the copyright to be the issue, since this is not constantly and happens at random moment & intervals.
"debug_error": "{\"errorCode\":\"auth\",\"errorDetail\":\"0\",\"errorMessage\":\"Deze video is niet beschikbaar\",\"yk\":\"\",\"xI\":\"0;a6s.0\",\"aB\":2}",
I've had to debug this issue for a week since it happened so randomly. No idea what causes it, but what I did to get around it was altering the onReady event function to check the errorCode, and then stop the video before we call the play event.
function onPlayerReady(event) {
var data = event.target.playerInfo.videoData;
if (data.errorCode == "auth") {
event.target.stopVideo();
}
event.target.playVideo();
}
onPlayerReady is what we call on the onReady event, as in options.events.onReady.
This only does the check once, since I did not want to hammer Youtube if a video doesn't load.
It is a very aggravating problem and I can't seem to find any more info on it either. An auth error would point to something authentication related, but we get this with videos we own and specifically enabled for embedding, and as far as I know the iframe api does not require any api keys to use.
Maybe I'm missing something here, but in Google Analytics V3 (analytics.js or gtag.js) setting the transport or transport_type to beacon would make the request to google-analytics.com/x/collect be sent using POST, i.e. no GET-parameters would be shown in the request URL.
When using GA4 (and a G- measurement ID) setting this parameter does nothing. This is what my tracking code looks like:
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXX', {"transport_type":"beacon"});
Am I doing something wrong, or am I simply misinterpreting how the beacon works in GA4? If the latter, is there any way to make GA4 function in a similar manner? What I'd like to achieve is send requests, that look like:
https://www.google-analytics.com/g/collect
As opposed to:
https://www.google-analytics.com/g/collect?param=1¶m_2=2&etc=etc
Hopefully someone'll be able to help me out, as the documentation is very limited ATM.
In Firefox in Network section of developer tools you can see the initiator of hit, and it say the way how hit was sent. If you see something like js.56 (beacon) you can be sure that hit was sent via navigator.sendBeacon() method of Beacon API
Setting parameter transport_type to beacon indeed do nothing, because ga4 hits are sent using this method by default.
I've been trying to use the Analytics API to get site search terms into a Google Ads script. I've used this basic setup before and it worked perfectly, but the data this time doesn't match what's in the interface by a long shot. I've also tried using the query explorer but that's also giving me very different numbers to what's in the interface (by almost a factor of 10).
I've checked and double checked that the metrics and dimensions I'm using are correct, but there really aren't that many options. Does anyone know what I'm doing wrong?
Here's the code I've been using:
// Build the query for the Analytics API
var query = {
"optionalArgs": { "dimensions": "ga:searchKeyword", },
"ids": "ga:" + analyticsView,
"metrics": "ga:searchUniques",
"start-date": startDate,
"end-date": "yesterday" };
var results = Analytics.Data.Ga.get(query.ids, query['start-date'], query['end-date'], query.metrics, query.optionalArgs);
// Format the results for Javascript
var formattedJson = JSON.stringify(results, null, 2);
var jsonData = JSON.parse(formattedJson);
// Iterate through the results
for (var i = 0; i < jsonData.rows.length; i++) {
var row = jsonData.rows[i];
var searchTerm = row[0];
var sessions = row[1];
I've tried with ga:sessions instead of searchUniques and a few other combinations of metrics and dimensions but nothing works and based on the documentation the ones I have in the code really seem to me to be the right ones!
I've noticed this myself just now (May 2019) when comparing a regular monthly-run API query to the Query Explorer today. The Query Explorer numbers are, similar to your case, at least about nine times greater.
The API-sourced numbers seem to be pretty consistent, and in the past the Query Explorer numbers were in line with the API-sourced numbers, so...
The only conclusion I can make is that the Query Explorer is presently broken (or changed enough it would take significant alteration in its usage to make it not broken).
This is consistent with my expectations of Google code "quality" and "QA".
I would suggest you rely on Google less as much as possible. They do not make reliable products, and they are not interested in your business’ longevity.
In case anyone else gets stuck here, my issue was simply that I was limited to a maximum of 10,000 entities returned, and since I wasn't sorting them I was getting 10,000 random ones back and not what I expected. As soon as I sorted them descending by what I needed I got exactly what I expected!
We need to track conversions that happen on a 3rd party site. The only thing we can place on that site is an image pixel and maybe some JS logic for when to fire it.
I know it is possible to fire a conversion using the Measurement Protocol: https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#visitor
Ideally, I'd just give the 3rd party an IMG url and that would be it. The problem is the CID (unique client id).
I can try passing the CID from our site to the 3rd party via URL parameter. However, there are many cases where its not available (e.g., IMG pixcel will be in an email, the goal URL is on printed literature) or the 3rd party is not willing to go through the hassle. Is it best practice to pass this CID in this way?
I can try generating a CID, but I can't find a dead simple way of doing that e.g., var CID = generateCID(). The 3rd party site has its own GA on the page. Can I just take their Google Analytics CID and use it in the image pixel URL?
What the best way to do this? Thank you!
If the 3rd-party site has analytics.js already running then using that client ID is probably best. You can get it by doing the following:
var cid;
ga(function(tracker) {
cid = tracker.get('clientId'));
});
If analytics.js is not running, or if you can't access the ga variable for some reason, you can just generate the client ID randomly. This is approximately what Google does. It's a random 31-bit integer with the current date string appended:
var cid = Math.floor(Math.random() * 0x7FFFFFFF) + "." +
Math.floor(Date.now() / 1000);
Only to complement #Philip Walton excellent answer, Google Analytics expects a random UUID (version 4) as the Client ID, according to the official Documentation.
Client ID
Required for all hit types.
This anonymously identifies a particular user, device, or browser
instance. For the web, this is generally stored as a first-party
cookie with a two-year expiration. For mobile apps, this is randomly
generated for each particular instance of an application install. The
value of this field should be a random UUID (version 4) as described
in http://www.ietf.org/rfc/rfc4122.txt
#broofa provided a simple way to generate a RFC4122-compliant UUID in JavaScript here. Quoting it here for the sake of completeness:
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
});
Whenever I try to test a Qualtrics survey in preview mode, Qualtrics.SurveyEngine.addOnload will be called twice. This is not a problem for conditional events (as in most of the examples), but a large problem for unconditional code a timed page change (this will be triggered twice as well). See the following snippet:
Qualtrics.SurveyEngine.addOnload(function()
{
$('NextButton') && $('NextButton').hide();
var that = this;
var timeOutInterval=1000+Math.trunc(Math.random()*10000);
alert(timeOutInterval); //for Testing only
var myVar;
myVar = setTimeout(function(){ that.clickNextButton();}, timeOutInterval);
});
If I launch the survey, this will lead to a page change after 1-11 seconds. If I preview the survey, this change will happen as well, followed by a second change. The alert will be shown twice as well.
Does anyone have a solution, how this functionality could be tested in preview mode?
I've run into Survey Preview issues with JFE as well. There are ways to get around JFE mode and preview in non-JFE mode.
If only care about a specific set of questions in a block and don't care about the survey flow, the easiest solution is to use View Block. It does not use JFE. Go to the Block drop down and choose View Block.
If you need to preview the whole survey, there are tricks to 'break' JFE and force it to non-JFE mode. These tricks seem to be a moving target as Qualtrics makes changes. The best one (easiest) I've found that is working for me today on my Qualtrics account (notice all the qualifiers) is to add an end of survey object to the survey flow, click custom, and check the "Override Survey Options" box.
If that doesn't work, I've found that once a survey gets over a certain size, it doesn't use JFE mode anymore. I don't know what the limit is, but if you add a bunch of fake questions after your end of survey you can trick it that way as well.
Qualtrics links jQuery as of current writing (albeit the shorthand $ is reserved for the prototype.js library).
Following should skip execution of addOnload javascript in the mobile preview:
Qualtrics.SurveyEngine.addOnload(function()
{
if(jQuery(this.questionContainer).parents('.MobilePreviewFrame').length)
{
console.log('Mobile Preview - skipping rest of addOnload');
return true;
};
console.log("Running addOnload()");
// The rest of your code. Log statements can obviously be removed
});
Hope this is helpful
It seems Qualtrics now defaults to JFE mode for live surveys as well. We have been able to resolve this by adding the query string &Q_JFE=0 to the end of our survey URLs, like so:
https://uleidenss.eu.qualtrics.com/SE/?SID=SV_123432434343&Q_JFE=0
This had the additional benefit of solving our issue with JFE mode breaking several of our long time running Qualtrics JQuery experiments.