I want to make a string into a URL using C#. There must be something in the .NET framework that should help, right?
I have tried to follow the documentation but was not able to use urlparse.parse.quote_plus()
in Python 3
:
from urllib.parse import urlparseparams = urlparse.parse.quote_plus({'username': 'administrator', 'password': 'xyz'})
I get
AttributeError: 'function' object has no attribute 'parse'
I'm attempting to send hit payloads as part of a POST for the Google Analytics Measurement Protocol for my iOS android app.
Here's a hit I'm sending for session control:
&dp=scenes%2Estudio%2EScene&geoid=TESTING&z=818790&sr=480x270&ul=en&sc=start&ds=simulator&dl=scenes%2Estudio%2EScene&dr=iOS&tid=UA%2Dxxxxxxx%2D1&ti=TESTING&cid=TESTING&aip=1&an=FE&cd=scenes%2Estudio%2EScene&aid=xxx%2Eyyyy%2Ezzz%2E&v=1&av=16%2E5%2E2
And here's a hit I'm sending for an exception event:
&dp=scenes%2Emenu%2EScene&geoid=TESTING&z=217660&sr=480x270&ul=en&exf=1&ds=simulator&dl=scenes%2Emenu%2EScene&dr=iOS&aid=xxx%2Eyyy%2Ezzz%2E&ti=TESTING&cid=TESTING&tid=UA%2D117928712%2D1&exd=%2FUsers%2Fchomsky%2Fapps%2Ffunbox%2Fapps%2Fxxx%2Flib%2Fscamp%2Fdebug%2FmenuButtons%2FFE%2Elua%3A147%3A+822Error&aip=1&an=FE&cd=scenes%2Emenu%2EScene&v=1&av=16%2E5%2E2&t=exception
I've checked both with the hit validator (https://ga-dev-tools.appspot.com/hit-builder/), and it says they're valid, (although I've altered these slightly so it doesn't contain my personal information, hence the x's, y's, and z's.
When I send it to https://www.google-analytics.com/debug/collect, it gives me back this message:
Output multiple: return { bytesEstimated=-1, bytesTransferred=682, isError=false, name="networkRequest", phase="ended", requestId=userdata, response="{\ \"hitParsingResult\": [ {\ \"valid\": true,\ \"parserMessage\": [ {\ \"messageType\": \"INFO\",\ \"description\": \"IP Address from this hit was anonymized to 114.35.138.0.\",\ \"messageCode\": \"VALUE_MODIFIED\"\ } ],\ \"hit\": \"/debug/collect?dp=scenes.studio.Scene\\u0026geoid=TESTING\\u0026z=818790\\u0026sr=480x270\\u0026ul=en\\u0026sc=start\\u0026ds=simulator\\u0026dl=scenes.studio.Scene\\u0026dr=iOS\\u0026tid=UA-xxxxxx-1\\u0026ti=TESTING\\u0026cid=TESTING\\u0026aip=1\\u0026an=FE\\u0026cd=scenes.studio.Scene\\u0026aid=xxx.yyy.zzzz.\\u0026v=1\\u0026av=16.5.2\"\ } ],\ \"parserMessage\": [ {\ \"messageType\": \"INFO\",\ \"description\": \"Found 1 hit in the request.\"\ } ]\ }\ ", responseHeaders={ ["Access-Control-Allow-Origin"]="*", ["Alt-Svc"]="hq=\":443\"; ma=2592000; quic=51303433; quic=51303432; quic=51303431; quic=51303339; quic=51303335,quic=\":443\"; ma=2592000; v=\"43,42,41,39,35\"", ["Cache-Control"]="private", ["Content-Encoding"]="gzip", ["Content-Type"]="application/javascript; charset=utf-8", Date="Wed, 25 Apr 2018 09:38:44 GMT", Server="MPVS", ["Transfer-Encoding"]="Identity", ["X-Content-Type-Options"]="nosniff", ["X-Frame-Options"]="SAMEORIGIN", ["X-XSS-Protection"]="1; mode=block" }, responseType="text", status=200, url="https://www.google-analytics.com/debug/collect" }
It looks to me like it came back 200 with no problems.
However, when I send this same hit to https://www.google-analytics.com/collect, so I can see it in the Analytics website's console, I don't see the request appear. It says that there is a user on my app right now (it's me!) but I can't see any of the exceptions or session control events I'm sending -- it shows no events of any kind received today. Is there a reason why this would be happening? Am I missing something in my hit, or do I not know where to look?
The certutil utiliiy in Windows can be used to perform Base64 encoding and deocding. Is there any built-in utility for URL encoding and decoding? There are many free tools available on web. But I am specifically looking for Windows built-in utility or if not simple script that can run on Windows.
Thanks!
Do you know a fast and simple way to encode a Javascript Object into a string
that I can pass via a GET
Request?
No jQuery
, no other frameworks - just plain Javascript :)
Domácí - Mapa stránek - Soukromí - Links - Copyright © 2018 Cortex IT Ltd : Kontakt : admin @ cortexit.co.uk
Please note that by viewing our site you agree to our use of cookies (see Soukromí for details). You will only see this message once.