THIS ARTICLE WILL HELP YOU:
Issue
There is currently no one-step way of configuring a Decrease Bounce Rate goal per device (desktop, mobile, tablet) within the app.
The following solution allows you to create Decrease Bounce Rate goals for different type of devices: desktop, mobile, and tablet.
*Be aware that a device can be classified in more than one category.
Solution
- First, create a Custom JavaScript goal from the goal templates and attach it to your experiment.
- After you create it, copy the ID of your goal. You can find the ID if you go to the goals page.
- Then, you will have to add the following code to the Global JavaScript section of your Project. You can find this section by clicking on the Setting menu item on the left sidebar and scrolling down to the Global JavaScript text box.
Un-comment the appropriate line for the segmentation of the type of device type you want to track. Only leave one un-commented; otherwise this solution code will not work properly.
window._conv_q = window._conv_q || [];
// Uncomment only one of the following three lines depending on what device you want to segment the goal for
// If need to track another type of device create another goal
if ( convertData.dev.desktop === 1) {
// if convertData.dev.mobile === 1) {
// if convertData.dev.tablet === 1) {
// for only mobile phones is the next line
// if (convertData.dev.mobile === 1 && convertData.dev.tablet != 1)
if (!(document.cookie.match(/^(.*;)?\s*_conv_v\s*=\s*[^;]+(.*)?$/) == null)) {
/// Substitute the 123456789 for the id of the goal you have created
_conv_q.push(["triggerConversion","100128755"]);
console.log('Decrease Bouncerate Mobile Goal Triggered on second page visit');
}
else {
setTimeout(function(){
_conv_q.push(["triggerConversion","100128755"]);
console.log('Decrease Bouncerate Mobile Goal triggered after 10 seconds of staying on page'); }, 10000);
}
}
You can make sure that you did not make any syntax errors in the code by checking it in the browser console. Just paste the code and press enter. You should see any errors you might have introduced while editing it.
Now you are ready to go!