In addition to our feedback integrations you can push campaign results to 3rd party tools of your choice directly in the browser of the user. This allows you to connect your qualitative user insights from GetFeedback Digital to other data providers and any data layer, such as your analytics suite, personalisation software or your A/B-testing tool.
The below snippet demonstrates how campaign results can be sent to Google Analytics whenever a user completes a campaign on your website. You can use the below examples to insert the desired action or replace the bold part by your own code.
Example snippet
window.usabilla_live("setEventCallback", function(category, action, label, value) {
if(action != "Campaign:Open") {
return;
}
window.addEventListener("message", function(event) {
// Listen to messages from the Usabilla Cloudfront domain
if(!/d6tizftlrpuof\.cloudfront\.net/.test(event.origin)) {
return;
}
try {
var data = JSON.parse(event.data);
// On the final page
if(data.type === "pageSwitch" && data.end) {
for(var key in data.data) {
ga('gtag_trackerName' + '.send', 'event',
'Usabilla Campaign - ' + label, // event category
key, // event action
data.data[key] // event label
);
}
}
} catch(e) {
// Ignore errors, usually JSON decode problems
}
});
});
Example 1 - Google Analytics
In this example, we push campaign results to Google Analytics using Events. These events can be aggregated and used within the analytic suite for further analysis. The following code needs to be implemented in the above-mentioned example;
ga('gtag_trackerName' + '.send', 'event',
'Usabilla Campaign - ' + label, // event category
key, // event action
data.data[key] // event label
)
NB: Make sure you define your gtag tracker name in the above mentioned code to make it work. You shall be able to find your gtag tracker name by using Google Analytics debugger. Your gtag tracker name will be your tracking ID with underscores instead of hyphens in it, and 'gtag_' appended in front of the tracking ID. E.g. Analytics ID = 'UA-131415167-1'. As a gtag tracker name it will be defined as: 'gtag_UA_131415167_1'
Now, whenever a user fills in a campaign, the following information will be sent as an Event to Google Analytics:
- Event Category:
Example 2 - Innometrics
In this example we will push campaign results to Innometrics using a trigger. The following code needs to be implemented in the aforementioned mentioned script:
var ubdata = {data, 'category': category, 'action': action, 'label': label, 'value': value}
$('body').trigger('usabilla_update', ubdata)
In this example, you will store all the desired information in a specific javascript object. By using jQuery you can trigger a specific event. The Innometrics Tag Manager needs to listen to this event. When this event is triggered it can read the provided information (the campaign responses). At Innometrics you can filter on this data with certain conditions, and do awesome stuff with the information. In the example below, this information will be sent to Adobe Analytics.
