PDFs


This page applies to an earlier version of the AppDynamics App IQ Platform.
For documentation on the latest version, see the 4.5 Documentation.


On this page:

Related pages:

Your Rating:
Results:
PatheticBadOKGoodOutstanding!
62 rates

You can add user information that is specific to your application to a browser snapshot. The information is expressed as key-value pairs, and the maximum size of all user data in a page is 100 bytes. The information appears in the User Data section of the snapshot and is available for page snapshots, Ajax requests, and virtual pages.

Add User Data

User data is added when certain events are triggered. You can choose to set user data for each or all of the following available events:

  • PageView - this event is triggered when the base page is loaded in the browser.
  • Ajax - this event is triggered when an Ajax call is made.
  • VPageView - this event is triggered when the virtual page is created. The virtual page is a dynamically recreated version of the base page.

The events are callbacks that are part of the userEventInfo object that is assigned to window['adrum-config'] as shown below. Here just the event callback PageView is passed. Also, note that you must set window['adrum-config'] before you inject the adrum.js script.

<head>
    <script type="text/javascript">
        window["adrum-start-time"] = new Date().getTime();
        window['adrum-config'] = {
            userEventInfo: {
                PageView: function(context) {
                    ...
                }
            }
        };
        ...
        if ('https:' === document.location.protocol) {
            document.write(unescape('%3Cscript') 
            + " src='https://cdn.appdynamics.com/adrum/adrum-latest.js' "
            + " type='text/javascript' charset='UTF-8'"
            + unescape('%3E%3C/script%3E'));
        } else {
            document.write(unescape('%3Cscript')
            + " src='http://cdn.appdynamics.com/adrum/adrum-latest.js' "
            + " type='text/javascript' charset='UTF-8'"
            + unescape('%3E%3C/script%3E'));
        }
    </script>
</head>

For each event callback that is triggered, you can add user data by returning the following objects containing key-value pairs of different data types:

  • userData
  • userDataLong
  • userDataBoolean
  • userDataDate

So, using the same snippet with the PageView event, let's add some user data using the objects above:

<head>
    <script type="text/javascript">
        window["adrum-start-time"] = new Date().getTime();
        window['adrum-config'] = {
            userEventInfo: {
                "PageView": function(context) {
                    return {
                        userPageName: "Shopping Cart",
                        userData: {
                            username: "john_thompson",
                            email: "jthompson@gmail.com"
                        },
                        userDataLong: {
                            total_price: 123.14
                        },
                        userDataDouble: {
                            monthlyVisitFrequency: 0.13333333
                        },
                        userDataBoolean: {
                            returnCustomer: true
                        },
                        userDataDate: {
                            checkoutTime: ((new Date()).getTime()),
                        }
                    }
                },
                "Ajax" : function(context) {
                    if (context.method.toLowerCase() === 'post' && context.url.endsWith('buy')) {
                        var action = "purchase";
                        var purchase = true;
                    } else {
                        action = "query";
                        purchase = false;
                    }
                    return {
                        userData: {
                            username: "john_thompson",
                            action: action
                        },
                        userDataLong: {
                            tax: 0.0825
                        },
                        userDataDouble: {
                            total: total_price * tax
                        },
                        userDataBoolean: {
                            purchase: purchase
                        },
                        userDataDate: {
                            transactionTime: ((new Date()).getTime()),
                        }
                    }
                },
                "VPageView": function(context) {
                    return {
                        userData: {
                            first_name: "John",
                            last_name: "Thompson"
                        },
                        userDataLong: {
                            longExample1: 129414,
                            longExample2: 524546
                        }
                    }
                }
            }
        };
        ...
        if ('https:' === document.location.protocol) {
            document.write(unescape('%3Cscript') 
            + " src='https://cdn.appdynamics.com/adrum/adrum-latest.js' "
            + " type='text/javascript' charset='UTF-8'"
            + unescape('%3E%3C/script%3E'));
        } else {
            document.write(unescape('%3Cscript')
            + " src='http://cdn.appdynamics.com/adrum/adrum-latest.js' "
            + " type='text/javascript' charset='UTF-8'"
            + unescape('%3E%3C/script%3E'));
        }
    </script>
    ...
</head>

The results from the code snippet above should then appear in the browser snapshot in the User Data panel.

  • username: john_thompson
  • email: jthompson@gmail.com
  • total_price: 123.14
  • monthlyVisitFrequency: 0.133333
  • returnCustomer: true
  • checkoutTime: 1464390383475

Filter by User Data

You can filter browser snapshots based on user data in the Advanced section of the browser snapshot filter: