Skip to content

Fetch reporting metrics from interaction

Overview

In this tutorial we will be fetching all metrics from an IB report. We will use a small example of an interaction.

interaction example

Note

You will need the element-id for the Actions metrics. The rest of the metrics make use of the interaction UUID.

To find the specific identifier for the views in interaction builder, you can either:

  • Check elements in IB report with the web inspector;
  • Check elements in IB with the web inspector;
  • Use the JS Console in IB with store.widgetEditor.currentViewUid to get the current view.

find element in IB report

To find the interaction UUID you can go to IB under the menu of the interaction name, there you’ll find a field that says: Interaction ID or it can be found in the url.

Find UUID in IB

Prerequisites

A guide on how to create an API token can be found here

Once you have obtained your API token(s), define the Authorization HTTP header for all your API requests:

1
Authorization: Token <api_key>

You should replace the <api_key> with your API token

Remember that the api token is connected to the user that created the token, which means that if the user is deleted the api token will also be invalidated. You can create an extra user and create the token with this user, remember to name the user so that it doesn’t get deleted by mistake e.g “Reporting api-user do not delete”

Which metrics can I request?

giosg has multiple metrics that are used in the interaction builder report, these are:

Metrics

Views

The following query can be made to fetch the viewed metrics per interaction view. You will need to change the <organization_id> and <interaction_id> with the respective UUIDs of your organization & interaction.

Request URL: POST https://service.giosg.com/api/events/v2/orgs/<organization_id>/fetch

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{
    "sources":[
        "trusted",
        "untrusted"
    ],
    "interval":{
        "start":"2021-11-26T00:00:00.000+02:00",
        "end":"2022-02-08T23:59:59.999+02:00",
        "time_zone":"Europe/Helsinki"
    },
    "granularity":"all",
    "group_by":[
        "dim1"
    ],
    "organization_id":"<organization_id>",
    "vendor":"com.giosg.editor",
    "aggregations":[
        "session_id_uniq"
    ],
    "filters":{
        "type":"and",
        "fields":[
            {
                "type":"selector",
                "dimension":"category",
                "value":"widget"
            },
            {
                "type":"selector",
                "dimension":"action",
                "value":"showview"
            },
            {
                "type":"selector",
                "dimension":"label",
                "value":"<interaction_id>"
            }
        ]
    }
}

Interacted

The following query can be made to fetch the interacted metrics per interaction view. You will need to change the <organization_id> and <interaction_id> with the respective UUIDs of your organization & interaction.

Request URL: POST https://service.giosg.com/api/events/v2/orgs/<organization_id>/fetch

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
    "sources":[
        "trusted",
        "untrusted"
    ],
    "interval":{
        "start":"2021-11-26T00:00:00.000+02:00",
        "end":"2022-02-08T23:59:59.999+02:00",
        "time_zone":"Europe/Helsinki"
    },
    "granularity":"all",
    "group_by":[
        "dim1"
    ],
    "organization_id":"<organization_id>",
    "vendor":"com.giosg.editor",
    "aggregations":[
        "session_id_uniq"
    ],
    "filters":{
        "type":"and",
        "fields":[
            {
                "type":"in",
                "dimension":"action",
                "values":[
                    "changeview",
                    "formdata",
                    "openchat",
                    "runjs",
                    "leadform",
                    "url"
                ]
            },
            {
                "type":"selector",
                "dimension":"category",
                "value":"widget"
            },
            {
                "type":"selector",
                "dimension":"label",
                "value":"<interaction_id>"
            }
        ]
    }
}

Missed (Exits)

The following query can be made to fetch the missed metrics per interaction view. You will need to change the <organization_id> and <interaction_id> with the respective UUIDs of your organization & interaction.

Request URL: POST https://service.giosg.com/api/events/v2/orgs/<organization_id>/fetch

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{
    "sources":[
        "trusted",
        "untrusted"
    ],
    "interval":{
        "start":"2021-11-26T00:00:00.000+02:00",
        "end":"2022-02-08T23:59:59.999+02:00",
        "time_zone":"Europe/Helsinki"
    },
    "granularity":"all",
    "group_by":[
        "dim1"
    ],
    "organization_id":"<organization_id>",
    "vendor":"com.giosg.editor",
    "aggregations":[
        "session_id_uniq"
    ],
    "filters":{
        "type":"and",
        "fields":[
            {
                "type":"selector",
                "dimension":"category",
                "value":"widget"
            },
            {
                "type":"selector",
                "dimension":"action",
                "value":"exit"
            },
            {
                "type":"selector",
                "dimension":"label",
                "value":"<interaction_id>"
            }
        ]
    }
}

Actions

The following query can be made to fetch the action metrics per action. An action is for instance a button click. You will need to change the <organization_id> and <interaction_id> with the respective UUIDs of your organization & interaction.

Request URL: POST https://service.giosg.com/api/events/v2/orgs/<organization_id>/fetch

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
    "sources":[
        "trusted",
        "untrusted"
    ],
    "interval":{
        "start":"2021-11-26T00:00:00.000+02:00",
        "end":"2022-02-08T23:59:59.999+02:00",
        "time_zone":"Europe/Helsinki"
    },
    "granularity":"all",
    "group_by":[
        "dim2"
    ],
    "organization_id":"<organization_id>",
    "vendor":"com.giosg.editor",
    "aggregations":[
        "session_id_uniq"
    ],
    "filters":{
        "type":"and",
        "fields":[
            {
                "type":"in",
                "dimension":"action",
                "values":[
                    "changeview",
                    "formdata",
                    "openchat",
                    "runjs",
                    "leadform",
                    "url"
                ]
            },
            {
                "type":"selector",
                "dimension":"category",
                "value":"widget"
            },
            {
                "type":"selector",
                "dimension":"label",
                "value":"<interaction_id>"
            }
        ]
    }
}

Goals

The following query can be made to fetch the goal hit per interaction view. You will need to change the <organization_id> and <interaction_id> with the respective UUIDs of your organization & interaction.

Request URL: POST https://service.giosg.com/api/events/v2/orgs/<organization_id>/fetch

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{
    "sources":[
        "trusted"
    ],
    "interval":{
        "start":"2021-11-26T00:00:00.000+02:00",
        "end":"2022-02-08T23:59:59.999+02:00",
        "time_zone":"Europe/Helsinki"
    },
    "granularity":"all",
    "group_by":[
        "label"
    ],
    "organization_id":"<organization_id>",
    "vendor":"com.giosg.chat",
    "aggregations":[
        "session_id_uniq"
    ],
    "filters":{
        "type":"and",
        "fields":[
            {
                "type":"selector",
                "dimension":"category",
                "value":"goal"
            },
            {
                "type":"selector",
                "dimension":"action",
                "value":"trigger"
            },
            {
                "type":"selector",
                "dimension":"properties",
                "value":"interaction_id=<interaction_id>"
            }
        ]
    }
}

Conclusion

In this tutorial we have learnt how to request information from Giosg Reporting, and got some metrics that can be used further by your own IT in your own products or reports.

Endpoints used in this tutorial

  1. POST https://service.giosg.com/api/events/v2/orgs/<organization_id>/fetch