I have implemented a GTM server side container with GA4, it is correctly connected with the client space (the preview works).
I would not to send the ip to analytics, and I have excluded ip_override parameters in the GA4 tags ‘Parameters to Exclude’ section, but I am not sure that it is the correct way.
How can I verify that all is working fine?
In preview I checked the ‘outgoing HTTP request from Server’ and in the ‘Request URL’ post I see a value _uip with the ip. I guess I shouldn’t see this value if all works fine.
Related
how can I send a request to Google Server Side Tag Manager Instance?
With data-tag templates from Stape.io and other tools it worked.
But I want to send out a HTTP Request from Postman or something and see it on the Debug Mode on Server Side.
I always get an 400 and see nothing in debug mode.
Maybe you can help :) Thanks
I sent a get request through Postman to my Server Side instance and expect to see the request in the debug preview mode.
For a request to show up in the SGTM Preview Mode, it needs to have the X-Gtm-Server-Preview HTTP header.
To find yours, open the Preview Mode, click the three dots in the top right hand corner and click "Send requests manually".
I have set up a section on my Drupal 7 site to show press releases that are fetched from a remote service through a REST API. It works fine to fetch and show all press items via a very specific POST request.
But I have no luck when I want to fetch just one specific press item, which according to the API docs shall be done with a GET request.
In order to see what happens I want to view the GET request to the remote URL in Chrome, but I can't figure out how.
This is how I do it: when opening the page where I want to show only one full press item:
On my press item page...
https://examplesite.com/newsroom/pressrelease
... I have a custom block where this code is run:
$item_id = (int)$_GET['item_id'];
// Fetch specific pressRelease from remote API with custom token
$headers = array('Custom-Token'=>'[custom-token]', 'Accept'=>'text/json', 'Content-Type'=>'text/json');
$url = "https://[remote newsroom url/]$item_id";
dpm($url);
$options=array(
'method'=>'GET',
'headers'=>$headers
);
$result=drupal_http_request($url, $options);
dpm($result);
$data = json_decode($result->data, true);
dpm($data);
With my dpm statements I can see the request on the page, but I would really like to see the actual request and response in Chrome dev tools (under the Network tab). But there is nothing to be found. I have tried using extensions like Live HTTP Headers, with no luck. Only the request to view the local page is shown not the remote one.
How can I see the http request to the remote URL in Chrome or Firefox?
EDITED... the problem might be that the request is done while the page is generated on the server side, before it is loaded on my site?
The code that you are executing, lies on the server and cannot be viewed from network tools of the browser, The browser developer tools will be able to track only those request that are made directly from your browser, in the form of AJAX request etc.
In order to view the actual request, you need to use a network proxy like Charles or Fiddler on your server which will track all HTTP network traffic from your server.
Part of a site I am working on at the moment requires Audio/Video previews.
These are server from a different server to the main site.
The Streaming URL is of the form:
www.myserver.com/Preview.aspx?e=I_AM_AN_ENCRYPTED_KEY
The Key is generated by the server that hosts the file, not the site on which the previews are actually displayed. It's kind of an API.
Part of the security to stop these previews being played anywhere except this website is supposed to check the domain which is requesting this, but it seems that HttpContext.Current.Request.UrlReferrer is NULL when requested from an HTML5 video/audio element.
Without posting the domain along with the Key to the API, is there any way that I can get the referring URL on the receiving server, server side?
EDIT:
To clarify:
There is a website with HTML5 elements which are directed to a URL on a different server, the URL and key is provided by this server (not the website)
When the API server receives a request to stream the preview it checks the Key (which basically tells it what to play) and also checks for the referring domain against a list of allowed domains.
Figured it out - in case anyone cares...
Simply replace:
ReferringDomain = HttpContext.Current.Request.UrlReferrer
with :
ReferringDomain = HttpContext.Current.Request.Headers("Referer")
Sorted! :)
Is there any sort of data dump or data set with information from Web Server logs?
The information that I am mainly looking for are:
a) what type of request is it (POST or GET or HTTP or something else)
b) What type of data is being transferred (image, audio, video or text)
c) what is the size of the data that is being transferred
Information such as IP address, URL can be anonymous.
Are you using Firefox? If so, you can use the included Web Console tool to view all the HTTP request body being sent from your browser to the server and the response bodies, along with things like the method (GET, POST, etc.). This would be the same thing that a web server would be logging (except the IP address of the client is always you, obviously). You should be able to copy all the data and paste it to a file if you want a data dump.
To use the web console, click the orange Firefox button and then Web Developer > Web Console. Or if you're using an older version or have the Firefox button disabled, it's under the tools menu.
Edit: To get the most out of it, you'll want to right click on the console and select Log Request and Response Bodies. This will get you more information than just the headers.
Just trying to understand why they didn't use a REST API.
In REST, clients initiate requests to servers for resources; servers process those requests and return appropriate responses.
The utm.gif is not involved in server-to-client data transfer, but instead it's involved in moving data in the other direction.
Of course REST has HTTP methods for the client to communicate with servers (GET and POST) and indeed, Google Analytics directs the client's browser to send all analytics data to the GA servers via a GET Request. More precisely, a GET Request is comprised of a Request URL and Request Headers (e.g., Referer and User-Agent Headers).
All GA data--every single item--is assembled and packed into the Request URL's query string (everything after the '?'). But in order for that data to go from the client (where it is created) to the GA server (where it is logged and aggregated) there must be an HTTP Request, so the ga.js (google analytics script that's downloaded, unless it's cached, by the client, as a result of a function called when the page loads) directs the client to assemble all of the analytics data--e.g., cookies, location bar, request headers, etc.--concatenate it into a single string and append it as a query string to a URL (http://www.google-analytics.com/__utm.gif?) and that becomes the Request URL.
Of course there can't be an HTTP Request without a resource; so resource is the client requesting from the server? It doesn't need anything from the server, instead it wants to send information to the server. So the actual server resource requested by the client is purely pretextual--the resource isn't even needed by the client, it's solely requested to comply with the transmission protocol operator. Therefore, it makes sense to make that resource as small and as unobtrusive as possible, which is why it's a 1 x 1 transparent pixel in gif format. It is the smallest possible size and the least dense image format (bytes/pixel); I think it's a little over 30 bytes. A 1 x 1 image in the other common formats (e.g., jpeg, png, tiff) are larger.
This general scheme for transferring data between a client and a server has been around forever; there could very well be a better way of doing this, but it's the only way I know of (that satisfies the constraints imposed by a hosted analytics service).
(Google Analytics does indeed have two APIs--"Data Export" and "Management"--which are both RESTful Web Services.)
You can use __utm.gif in browsers that don't support javascript using the <noscript> tag (with some work on the server), as well as in email messages (with some work before sending the email).
How are you gonna make a REST request in an email message?
Because it's an image you can stick it anywhere you can use and image tag even if you can't execute JS. Many years back this Google pushed this for tracking of email campaigns. You could stick this formatted string in an html email message and then any client that displays the message will send that request to the GA servers and you will get at a minimum IP info (which get's you geo location also) depending on client you may also get OS, language and all the other browser settings. You don't get all the fancy analytics you get from the modern JS tracking scripts but if still has it's uses.
Here is a site that will help you format the request string and also has some more details.
Google pixel generator