Sending events to Google Analytics (GA) or Facebook via Quriobot

Connecting goals in Quriobot to a marketing tag from Quriobot is very easy to do! On this page, you can find two examples of Google Analytics and Facebook pixel.

If you want to follow everything in Google Analytics please use this explanation instead

Google Analytics (Universal Analytics):

To track custom events via Google Analytics, you can make use of the analytics JS API and the ‘script’ chat text type:

function () {
        ga.getAll()[0].send({
        hitType: 'event',
        eventCategory: 'Quriobot',
        eventAction: 'Started',
        eventLabel: window.location.href
    })
}

Google Analytics (GA4):

To track custom events via Google Analytics, you can make use of the analytics JS API and the ‘script’ chat text type:

function () {
    gtag('event', 'Quriobot', 
    {
        action: 'Started',
        label: window.location.href
    })
}

You can add the code above to any SCRIPT chat message (developer mode has to be enabled)(select this in the drop-down on the right side)within the bot when you want your event to be tracked:

Note that in this example we use the first existing GA tracker.

Alternatively, you can create a new one:

function() {
    ga('create', 'UA-XXXXX-Y', 'auto', 'tracker1');
    ga.getByName('tracker1').send({
        hitType: 'event',
        eventCategory: 'Quriobot',
        eventAction: 'Started',
        eventLabel: window.location.href
   })
}

Facebook pixel

For launching the Facebook pixel you can you Tracking pixel chat text type and insert the pixel code obtained from Facebook.

Note: If you want to use more parameters to connect with please find more info here: http://randomproblems.com/use-facebook-img-tag-fire-pixel-events/

Important note: please keep (local) rules about tracking people in mind and make sure you ask for permission.

Using GTM data layer to send the events

Steps:

1. Enable developer mode in QB

2. Set up the data layer push scripts per step (eg Start and finish)

3. Create a custom variable in GTM of the data layer variable type and you call that, for example, conversion_type

4. Create GTM triggers for, for example, chatbot started/finished from other intermediate steps where the data layer is fired.

5. Choose chatBot as the event name (that is the event name in the data layer push)

6. Choose a few adjusted events for the trigger

7. Choose a conversion type that is the same as the data layer variable (eg Chatbot started or chatbot ended)

8. Create a tag that is triggered by the above

choose as Category eg Chatbot

choose as Action: {{conversion_type}}

In the end, you have something like that in GTM:

The great thing is that you can fire conversions from GTM to Google Analytics, Google Ads, Facebook, and other channels in one fell swoop.

Edit this page

Tags
See also