Expand my Community achievements bar.

Tracking Failed Actions to Google Analytics

Avatar

Level 4

I'm trying to find some documentation to see if there is code that I can execute when a failed action occurs. I'd love to be able to send information to the dataLayer so I can start tracking these at scale. I can certainly observe those failed actions that happen in my own testing, but I don't believe there is a way to report on these in Adobe Target. I don't have Adobe Analytics; is there a current method to report on these failed actions events in Analytics for Target? 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

3 Replies

Avatar

Level 5

Can you please clarify what do you mean by "failed action"?
Is no campaign qualification consider as fail action? or more about server/connectivity errors?

Avatar

Level 4

A failed action is a partially failed application of the experience onto the page (Mbox). You can see an example of what that looks like in the post here

 

For example, I have an experience that replaces a good majority of the content on a specific page. I have a script like the following to check for and send associated activity information to the dataLayer, but that only checks if the Adobe Target request succeeded and what it got back. It doesn't tell me that the experience was successfully applied to the page. 

 

You can see what successful actions look like by debugging a working activity on a page that you know the activity is targeted to by appending the following query string parameter. 

?mboxTrace=window

 

That will send rendering events to the console --make sure you have verbose logging enabled if you are using Chrome--about the rendering of the activity(ies) on the page. You'll see messages like the following in the console. 

 

 

AT: Rendering action 
{action: 'appendContent', content: '<style id="adobeTargetExperienceStyles">...}
action: "appendContent"
content: "<style id=\"adobeTargetExperienceStyles\">\n    /
id: "54c8bbc7b4f641c6b0080d4fxxx"
selector: "head"
[[Prototype]]: Object

 

 

AT: Action rendered successfully 
{action: 'appendContent', content: '<style id="adobeTargetExperienceStyles">...}
action: "setContent"
content: "<style id=\"adobeTargetExperienceStyles\">\n    /
id: "54c8bbc7b4f641c6b0080dxxx"
selector: "head"
[[Prototype]]: Object

 

 

But here is what I'm looking for. Sometimes those rendering actions fail and the experience either fails completely or partially applies (in the example that you have CSS targeting global classes in the offer). It could be due to me trying to call a method that isn't supported by the browser or something else. What I'd like to understand is how often that fails and for which devices so I can debug on those devices to get any unknown issues resolved. So my goal here is to send those rendering debugging events (or just the failed action events) to the dataLayer so I can start tracking the application of the experiences in Google Analytics. 

 

 

 

Example Code in Adobe Launch to Send Activity Information to the Datalayer

 

document.addEventListener(adobe.target.event.REQUEST_SUCCEEDED, function (e) {
    var tokens = e.detail.responseTokens;

    if (isEmpty(tokens)) {
        console.log("No active Adobe Target activity.");
        return;
    } else {
        var uniqueTokens = distinct(tokens);
        uniqueTokens.forEach(function (token) {
            window.dataLayer.push({
                'event': 'adobeTargetMetaData',
                'CampaignName': token["activity.name"],
                'CampaignId': token["activity.id"],
                'RecipeName': token["experience.name"],
                'RecipeId': token["experience.id"],
                'OfferId': token["option.id"],
                'OfferName': token["option.name"],
                'MboxName': e.detail.mbox
            });
        });
    }

    function isEmpty(val) {
        return (val === undefined || val == null || val.length <= 0) ? true : false;
    }

    function key(obj) {
        return Object.keys(obj)
            .map(function (k) {
                return k + "" + obj[k];
            })
            .join("");
    }

    function distinct(arr) {
        var result = arr.reduce(function (acc, e) {
            acc[key(e)] = e;
            return acc;
        }, {});

        return Object.keys(result)
            .map(function (k) {
                return result[k];
            });
    }
})

 

 

Avatar

Administrator

Thanks for your question zach_shearer, and thanks abu_shafi for weighing in with your insights! I know this question is a few years old but in case anyone wants to try to take a stab at it to close it out with deeper insights, please do  Cheers!

CC our brilliant Advisors:  , and 

and our inspiring Mentors: @abhilashsape@Gokul_Agiwal@Rajneesh_Gautam_@PratheepArunRaj, and @Sneha-Parmar