Automatic tests of click events - testing

Clicks on certain DOM elements sents click events to Google Analytics, as URL requests like https://stats.g.doubleclick.net/r/collect?v=1&aip=1&t=dc&_r=3&tid=UA-1234567-2&cid=297722160.1523959944&jid=2028321276&_gid=1320758195.1530624077&gjid=12698493&_v=j68&z=1135539045
What tools/methods/workarounds are usual to automatically test click events - mainly their status code and content?

I am not 100% sure that I understand your question. First think you should understand is that hits sent to google analytics are not validated they are send and forget. Google analytics returns a gif thats it there is no way to know if the request was a success or a fail.
There is one way of debugging hits being sent to Google analytics in test before you actually release to production and thats the debug endpoint
https://www.google-analytics.com/debug/collect?v=1&aip=1&t=dc&_r=3&tid=UA-1234567-2&cid=297722160.1523959944&jid=2028321276&_gid=1320758195.1530624077&gjid=12698493&_v=j68&z=1135539045
sending your hit to the debug endpoint results in
{
"hitParsingResult": [ {
"valid": true,
"parserMessage": [ {
"messageType": "INFO",
"description": "IP Address from this hit was anonymized to 185.128.103.0.",
"messageCode": "VALUE_MODIFIED"
} ],
"hit": "/debug/collect?v=1\u0026aip=1\u0026t=dc\u0026_r=3\u0026tid=UA-1234567-2\u0026cid=297722160.1523959944\u0026jid=2028321276\u0026_gid=1320758195.1530624077\u0026gjid=12698493\u0026_v=j68\u0026z=1135539045"
} ],
"parserMessage": [ {
"messageType": "INFO",
"description": "Found 1 hit in the request."
} ]
}
This hit was not actually sent to google analytics it was just test sent. If you want to set up some kind of unit testing or atuomation testing of your hits your going to have to do that yourself using the debug endpoint
More info can be found here validating-hits

Related

How do I fix the problem behind "THIRD_PARTY_AUTH_ERROR" when using Google's API Explorer to send a Firebase Cloud Messaging message?

I am trying to create a very simple Web app that can send and receive messages (including Push notifications) via Firebase Cloud Messaging. I want to try testing the ability to receive test messages sent from the Google API Explorer. However, I am running into a curious error as just about any API call from the relevant API URL will return the following error:
{
"error": {
"code": 401,
"message": "Auth error from APNS or Web Push Service",
"status": "UNAUTHENTICATED",
"details": [
{
"#type": "type.googleapis.com/google.firebase.fcm.v1.FcmError",
"errorCode": "THIRD_PARTY_AUTH_ERROR"
}
]
}
}
For reference, here is the message that I am trying to send:
{
"message": {
"token": "[FCM_TOKEN]",
"notification": {
"title": "New Notification",
"body": "Sample Text"
}
}
}
I also note that when I add "validate_only": true to the message, that the error goes away and the send request succeeds (though this is of no help, as that disables actually sending the message).
I am stumped, becuse the hint that pops up suggests that my OAuth2 credentials are invalid, though I leave the OAuth2 credential option checked and go through the authorization popup to provide my credentials.
Are you running the web app on Firefox, perhaps?
I have been running around my tail with this same issue for days now, and today I've found that there is an issue on Firefox, while this does work on Chrome:
Similar stack overflow question
The issue on the Firebase repository on Github
Although not a proper answer, I hope this helps.

Bot not Responding Alert in Google Chat API

I have used same code as mentioned in one of the samples available on Google Chat Documentation
https://github.com/googleworkspace/hangouts-chat-samples/blob/master/java/basic-async-bot/src/main/java/com/google/chat/bot/basic/async/Bot.java
But the google chat is first giving the message "BOTNAME not responding" then the reply from the bot.
I have even tried to post the message with the thread from previous message as mentioned in the documentation. But still not getting desired result.
Any kind of help will be appreciated.
I eventually got it. Actually, I was sending a response to google chat with some content. When I modified it, by sending a response without any content, the error is resolved and it is working fine as accepted.
it's a shame I didn't see this issue before.
Check your APPSCRIPT.JSON for a chat property {} at the end. With updates when deploying is being overwritten but Google is already solving =)
Ex of my appssript.json: (Correct)
{
"timeZone": "America/Fortaleza",
"exceptionLogging": "STACKDRIVER",
"runtimeVersion": "V8",
"dependencies": {
"libraries": [
{
"userSymbol": "cGoa",
"libraryId": "1v_l4xN3ICa0lAW315NQEzAHPSoNiFdWHsMEwj2qA5t9cgZ5VWci2Qxv2",
"version": "36"
},
{
"userSymbol": "OAuth1",
"libraryId": "1CXDCY5sqT9ph64fFwSzVtXnbjpSfWdRymafDrtIZ7Z_hwysTY7IIhi7s",
"version": "18"
},
{
"userSymbol": "Verificacao_CallBack",
"libraryId": "1dgfE9K71u1k7tkxQHy2F2oAAAYB_lVnZOj8bmL0sl-vMEQYq8bYrDE1J",
"version": "0",
"developmentMode": true
}
]
},
"chat": {
}
}
You can deploys news versions in OLD apps script editors!

Google Assistant - Account linking with Google Sign-In

I have an Express app which supports Google authentication and authorization via passport. I have begun integrating it with Google Assistant and things were going quite well but I am having trouble with the account linking as described at https://developers.google.com/actions/identity/google-sign-in#start_the_authentication_flow
Using the method in the docs at https://codelabs.developers.google.com/codelabs/actions-2/#4 I was able to get user details but when I try to modify to support
app.intent('Start Signin', conv => {
conv.ask(new SignIn('To get your account details'))
})
and
app.intent('Get Signin', (conv, params, signin) => { ...}
the dialogflow always falls back to my default fallback intent and I get an error in Express console
Error: Dialogflow IntentHandler not found for intent: Default Fallback Intent
My dialogflow intent is set to use webhook and other intents work fine (until I add these sign-in intents!)
Reading this thread Dialogflow IntentHandler not found for intent: myIntent (Dialogflow V2) it was suggested that the intent name rather than the action name is used so I check my Actions on Google simulator and the request contains:
"inputs": [
{
"intent": "actions.intent.SIGN_IN",
"rawInputs": [
{
"inputType": "KEYBOARD"
}
],
"arguments": [
{
"name": "SIGN_IN",
"extension": {
"#type": "type.googleapis.com/google.actions.v2.SignInValue",
"status": "OK"
}
}
]
}
],
so I tried updating my Dialogflow intent name to actions.intent.SIGN_IN and modifying the intent name in my Express app accordingly but it doesn't make any difference.
The simulator response includes:
"responseMetadata": {
"status": {
"code": 14,
"message": "Webhook error (206)"
},
but I'm not sure if that is just because for some reason the intent names are not matching up. Any help much appreciated!
As you speculate in the comments, the issue is that your "Get Signin" Intent isn't registered to get the event indicating that the user has signed in (or failed to). Since there is no such Intent setup, it ends up calling the Fallback Intent, which apparently doesn't have an Intent Handler registered in your webhook.
To make your "Get Signin" Intent get the sign-in event, set the "Event" field to actions_intent_SIGN_IN. (Note the similarity to the Intent name you saw in the simulator, but using underscores instead of dots.)
As an aside, the simulator was showing you what the communication between the Assistant and Dialogflow looks like, so it can be somewhat confusing to understand what Dialogflow is doing with it. It didn't have anything to do with the name of your Intent or anything else.
Finally, it often isn't necessary to do this check. You will know if the user is signed in because either the auth token has been set or the id token has been set (depending on your method of Account Linking).

Graph API Subscription Notification Fires Continuously

I am creating subscriptions to a OneDrive folder using the Graph API and I am receiving change notifications continuously (every half a second) even when the contents of the folder (or even the drive itself) is not changing. (Obviously I was expecting that I would receive notifications only when the folder contents change).
I post the following JSON to create the subscription:-
{
"clientState": "GraphAPITest1 2018/05/01 11:31:26",
"notificationUrl": "https://123e7ff5.ngrok.io/notification/listen",
"resource": "/drives/b!X5kF-EHEkECCcjyJ3Fh1CTQI-5nOBktJv57zZdpp13CPQb_8FIV-RIPt-7fnzyxP/root",
"expirationDateTime": "2018-05-02T11:31:26.0881202+01:00",
"changeType": "updated"
}
The notification that my service receives is:-
{
"value": [
{
"subscriptionId": "2467af01-a616-4493-8947-220146c4828a",
"clientState": "GraphAPITest1 2018/05/01 11:23:13",
"resource": "/drives/b!X5kF-EHEkECCcjyJ3Fh1CTQI-5nOBktJv57zZdpp13CPQb_8FIV-RIPt-7fnzyxP/root",
"resourceData": null,
"changeType": "updated",
"subscriptionExpirationDateTime": "2018-05-02T10:23:13.3640899+00:00"
}
]
}
I get the same behaviour in my own code as well as in Microsoft's example app (https://github.com/OneDrive/onedrive-webhooks-aspnet). My code uses an app-only authentication token but the Microsoft example forces user authentication - both suffer from the same behaviour.
Any idea what I need to do to only get notifications when the contents of the folder actually changes?
Barry

OAuth linking with actions on google

hello im trying to setup account linking for actions on google. when testing in the simulator there is no debugInfo.sharedDebugInfo info in the response. my question is what am i missing to get this to be populated. ive set the welcome intent to be signedIn via the api.ai console as well as all the other necessary fields for oauth linking.
view of the setting on api.ai console(signin required)
view of the setting on api.ai console(oauth form)
Once you enable the "sign-in required for Welcome intent", you should see it right after you ask the "can i talk to myAgent" question.
Here is what I see:
Request
{
"query": "can i talk to myAgent",
"accessToken": "ya29.GlzXA38i6oBr0UD5CxXzstBaYFpbQF0tL16jK7tefC2_lWvofj79TbCmrDS1jedhxc_-LJp0w6PW3CJN5wL3oOFoqSMAZ8TbAKiMW6SKcUM65DUVdsSWC65nc_Oezg"
}
Response
{
"response": "It looks like your myAgent account is not linked yet. You can link myAgent to your Google Account from the Google Home app.",
"audioResponse": "//NExAASi..."content_copy,
"debugInfo": {
"sharedDebugInfo": [
{
"name": "Account Linking Url",
"debugInfo": "https://assistant.google.com/services/auth/handoffs/auth/start?provider=myAgent-156006_dev&return_url=https://www.google.com/"
}
]
}
}