Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

ACC WebApp UTM REFERRER

David__Garcia
Level 8
Level 8

I am trying to come up with the best approach to capture traffic source on a WebApp..

 

I would like to identify if a user came through a particular campaign using UTM tags i.e ( 'utm_source','utm_medium','utm_campaign','utm_content') and possibly referrer.

 

Has anyone done something similar? I am thinking the only way to acomplish this is to create a script in jquery/javascript and pull the parameters from the url and store them in local ctx variables for further manipulation?

 

Can someone suggest an alternative approach?

referrer UTM
1 Accepted Solution
David__Garcia
Correct answer by
Level 8
Level 8

Here is my proposed approach which is working, it would be nice to know how others are achiving the same results.

 

 

<script type = "text/javascript" >
    var queryForm = function(settings) {
        var reset = settings && settings.reset ? settings.reset : false;
        var self = window.location.toString();
        var querystring = self.split("?");
        if (querystring.length > 1) {
            var pairs = querystring[1].split("&");
            for (i in pairs) {
                var keyval = pairs[i].split("=");
                if (reset || sessionStorage.getItem(keyval[0]) === null) {
                    sessionStorage.setItem(keyval[0], decodeURIComponent(keyval[1]));

                    if (pairs[i].indexOf('utm_source') > -1) {
                        document.controller.setValue('/ctx/vars/utm_source', keyval[1])
                    }

                    if (pairs[i].indexOf('utm_medium') > -1) {
                        document.controller.setValue('/ctx/vars/utm_medium', keyval[1])
                    }

                    if (pairs[i].indexOf('utm_campaign') > -1) {
                        document.controller.setValue('/ctx/vars/utm_campaign', keyval[1])
                    }

                    if (pairs[i].indexOf('utm_content') > -1) {
                        document.controller.setValue('/ctx/vars/utm_content', keyval[1])
                    }

                }
            }
        }
    }
setTimeout(function() {
    queryForm();
}, 3000);
 </script>

 

 The script iterates through tags found on the URL and assigns the values for our defined tags to webapp variables which can then be used to store in ACC.

View solution in original post

1 Reply
David__Garcia
Correct answer by
Level 8
Level 8

Here is my proposed approach which is working, it would be nice to know how others are achiving the same results.

 

 

<script type = "text/javascript" >
    var queryForm = function(settings) {
        var reset = settings && settings.reset ? settings.reset : false;
        var self = window.location.toString();
        var querystring = self.split("?");
        if (querystring.length > 1) {
            var pairs = querystring[1].split("&");
            for (i in pairs) {
                var keyval = pairs[i].split("=");
                if (reset || sessionStorage.getItem(keyval[0]) === null) {
                    sessionStorage.setItem(keyval[0], decodeURIComponent(keyval[1]));

                    if (pairs[i].indexOf('utm_source') > -1) {
                        document.controller.setValue('/ctx/vars/utm_source', keyval[1])
                    }

                    if (pairs[i].indexOf('utm_medium') > -1) {
                        document.controller.setValue('/ctx/vars/utm_medium', keyval[1])
                    }

                    if (pairs[i].indexOf('utm_campaign') > -1) {
                        document.controller.setValue('/ctx/vars/utm_campaign', keyval[1])
                    }

                    if (pairs[i].indexOf('utm_content') > -1) {
                        document.controller.setValue('/ctx/vars/utm_content', keyval[1])
                    }

                }
            }
        }
    }
setTimeout(function() {
    queryForm();
}, 3000);
 </script>

 

 The script iterates through tags found on the URL and assigns the values for our defined tags to webapp variables which can then be used to store in ACC.

View solution in original post