Is there a way to define input context for a Google Action with the Actions SDK? - actions-on-google

In the DialogFlow console, you can set an input and output context for an intent.
I would like to have the same functionality using the Actions SDK.
Since I can set the context in my fullfilment webhook in the code, the output SDK is covered.
However, how do I set the input context for an intent to only trigger if that context was fetched?
I could not find this in the documentation examples.

I don't believe you can in the same way, which is part of why they added Dialogflow.
Although as part of your response you can indicate the ExpectedInput for the next Intent, the documentation for the ExpectedIntent makes it clear that your Intents are only used for speech biasing - you'll always get the built-in TEXT Intent.
In fact, this documentation says that you'll only get custom Intents for the initial call - later Intents are always triggered with a built-in one.
Update: One thing you can do is to include information in the response that will be sent back to you in the next request.
If you're using the JavaScript SDK, this is done with the second parameter to ask() and is available via the getDialogState() function.
If you're sending back JSON, this is done using the conversationToken attribute and is available in conversation.conversationToken in the request object you're sent the next round.

Related

GA4 Conversion tracking using Measurement Protocol

[Edited. Added code sample and more explanations]
Is anybody familiar with the GA4 Measurement Protocol?
We are sending events from our backend servers to the server-side GTM container using the GA4 Measurement Protocol. Everything works fine except for conversion tracking. The events marked as conversion are not counted as conversions if we send those via MP (except for the default "purchase" event, it works perfectly). The same event with the same parameters counts as a conversion if we send it from the browser (client-side GTM). As I couldn't find anything about this issue online, the only thing left was to debug parameter by parameter using the server-side GTM preview mode. Here I discovered, that if I send events from the browser, the requests for events I mark as conversions in GA have "&_c=1" in their query string.
That means, as far as I understand it, that in order to get conversion events via MP, the event request needs to have "_c" query string parameter. I tried adding "_c" as an event param, but that didn't work. Is there a designated JSON parameter to mark the event as a conversion?
------------MORE INFO--------------
Here is an example of an event "Experts". This event gets sent from both the client-side and the server. As you can see in the screenshot, this event is marked as a conversion.
As you can see on the second screenshot, the actual events (137) are much more than the conversions detected (48). The difference are exactly the ones sent from the server-side.
Here is the request body of the server call:
{
"client_id":"Z9TLWnyVC2UK4UssPIVk8J+2n5BZhgWLtWSlFYYSwlg=.1642076344",
"user_id":"119412",
"events": [{
"name": "Experts",
"params": {
"tenweb_action": "[Test action]",
"tenweb_info": "[Some more info]",
"debug_mode":1,
"page_location": "https://10web.io/[some-test-page]"
}
}]
}
#Jan, #DaImTo, and everyone else that might have this issue in the future.
I think I've found a solution. Although it's unofficial and might break at any moment, it's the best one I've found so far. Here is what I ended up doing. While debugging via GTM preview mode I noticed, that in Event Data tab of conversion events there is an object "x-ga-system_properties", that, among other system variables, contains c:"1" . So I tried adding
"x-ga-system_properties":{"c":"1"}
to the event parameters JSON that we send to the Measurement Protocol endpoint of our server-side GTM.
IT WORKED. The events sent that way were registered as conversions by GA4.
Would be great to hear your thoughts on this. Do you think it's a stable solution? Do you think there will be official documentation on this from Google?

How to properly send event parameters with Facebook Server Events

I am setting Facebook Pixel for the first time with the Conversions API and all my TestEvents are correct and I am receiving the events I am supposed to. But in every event under "Overview" I have this error:
No event parameters were detected. Use Test events to view the parameters of an individual event trigger.
I am new to this so I don't even know if this is an error or if it should work like that.
I am having a similar problem.
I am sending Custom Events. The Pixel and Server events are successfully deduplicating. Custom parameters are within both tags, however while the custom parameters are successfully being sent (& are hence visible in Events Manager Test Events) by the Pixel tags, the custom parameters are missing when viewing the Server Events in Test Events.
I have used both Custom HTML tags originally, and now the Facebook tag template, but and have endlessly tweaked the settings, but just cannot resolve this.
Let me know if you made progress!
Here are some good links that may help you
https://www.simoahava.com/analytics/facebook-conversions-api-gtm-server-side-tagging/
https://www.simoahava.com/custom-templates/facebook-pixel/
https://www.optimizesmart.com/gtm-server-side-tagging-for-facebook/

Generic Training Phrase in Dialogflow

I'm trying to create a mock interview Action that asks a specific set of questions in a specific order, regardless of what the user says in response to each question. How can I set up the intent in Dialogflow to accept any phrase from a user to trigger the next question as the response?
Ex of the dialog path:
User: "I want to practice for an interview"
Google: "Question 1: tell me about yourself"
User: [says literally anything]
Google: "Great job. Question 2..."
User: [says literally anything]
Google: "Okay! Question 3..."
Using Dialogflow, you can create an intent that accepts any input by taking the user utterances and marking them as #sys.any.
Then you can do one of the following:
Use Dialogflow contexts to make the next step dependent on the first (this is good if you want to do everything in Dialogflow)
Keep track of the conversational state in your webhook using the app.data object.
There are a few good ways to handle what you want, the best solution will depend on your other needs.
If you're using a fulfillment webhook, you can handle this as part of the Fallback Intent. Make sure the checkbox to use fulfillment is on for the Fallback Intent, and you'll be sent everything that the user says that doesn't meet other structures. You'll need to keep count of how many times you've been called and you can store this as a parameter in a context, as part of the app.data session storage object, or as part of the app.userStore cross-session storage object. Your webhook will return the next question as a response.
If you want to avoid fulfillments and handle it through Dialogflow, you can use the same general idea, but you will need to keep track of which question you're on for each time. You can do this by creating multiple Fallback Intents with each one having as an Incoming Context a context named after which question you're expecting the user to answer (say "question_1") and the Outgoing Context named after the question that is in the reply (for example, "question_2").

Why my actions on Google doesn't recognize touch selection?

I'm writing a simple action on google without any webhooks. Every response is generated by dialogflow.
I have an intent that works flawless if I call it by speech or type but if I call it by selecting it from a list it doesn't work and the Default Fallback is called.
In the simulator it show the right "text" when I click on the list.
Have I done something wrong or did I need to specify something in the list?
This is how the list is generated
This is my intent
This is what happens in the simulator if I click on the "easyTravel" item in the list (it trigger the default fallback intent)
This is what happens in the simulator if I type "easyTravel" (the right intent is executed)
To catch a click on a list I need an intent configured to be triggered by the event actions_intent_OPTION
Only once I read this question - and your anwser - I could fix my own problem. Just to share: if you are using a webhook and are waiting for a webhook actions in your script, you can create a new intent, which has the event as #Edo states: actions_intent_OPTION. If you define an action in that intent, this is what will be trigger by your webhook. You can then get the parameter by (node.js):
const param = app.getSelectedOption();
Without the 'empty' intent, with the event and action, I was not receiving any input.

How to use standard events in the react native Facebook SDK

The Facebook SDK has the ability to record both custom events and standard events. The standard events are things like "Purchases" "Add to cart" "Completed Registration" etc...
Recording these standard events gives you access to specific bidding features on Facebook ads that you don't get without the events.
I have an app that has the React Native FBSDK
There are two methods for defining an event - one for purchases and one for everything else as seen here
There is zero documentation for standard events on react within the SDK on Github or on the event tracking docs on Facebook's developer platform.
Right now I'm trying to track the standard events by using their various names, as recorded across FB's documentation. I've tried the following:
AppEventsLogger.logEvent('FBSDKAppEventNameCompletedRegistration');
AppEventsLogger.logEvent('CompletedRegistration');
AppEventsLogger.logEvent('Completed Registration');
All of these just create custom events with those names, but aren't recognized as standard events.
Has anyone gotten standard events to work using the React Native wrapper for the FB SDK? If so how do you name the events to get FB to recognize them?
Update: As the comment below highlights, the more recent link is https://developers.facebook.com/docs/marketing-api/app-event-api/
It looks like you'll have to pass the strings that those standard events get evaluated to, i.e. instead of 'FBSDKAppEventNameCompletedRegistration', you'll have to use: 'fb_mobile_complete_registration'.
Here's the source:
Sorry if this is a bit late. Hope this helps.
I managed to find the actual event name by generating standard event code using tool on Facebook's documentation, run the code in AppDelegate.m, and get the exact key-values from Events Manager. With this roundabout way, I realized the actual name of Add to Cart event was fb_mobile_add_to_cart. From there I googled for the name and found the list documented in Marketing API (why not App Events?).
I don't know if it is the right place, but you can refer to https://developers.facebook.com/docs/marketing-api/app-event-api/ for actual standard event names and parameter names. At least it worked in my case. Here's my Add to Cart event code:
function logAddToCart(totalPrice, contentType, contentId, currency) {
const params = {
'fb_content_type': contentType,
'fb_content_id': contentId,
'fb_currency': currency
};
AppEventsLogger.logEvent('fb_mobile_add_to_cart', totalPrice, params);
}
I made a simple package with all events. Just import like
import FBEvents from "react-native-fbsdk-events";
// ...
AppEventsLogger(FBEvents.COMPLETE_REGISTRATITON, params);