Search code examples
springgoogle-analyticsspring-webflow

Google Campaigns tracking with Spring Web flow


I am using Spring Web Flow for one of my clients and by default the Post-Redirect-Get (PRG) configuration is switched on for the website. The client now wants to enable Google Campaigns to allow them to track the campaigns they launching. But, due to the PRG configuration, the information is lost during the redirect. We have already tried to switch-off the PRG configuration but it results in issues in other flow. Is there is any solution which has been suggested for Spring Web flow to track the Google Campaigns.

Thanks in advance.

P.S: We are currently using spring-webflow-2.0.9 and spring MVC 2.5.6


Solution

  • We have been able to solve the problem by doing a workaround.The steps are given below.

    1. To add a check in the application filter to look for all the Google Campaigns related data like utm_source / utm_medium / utm_campaign.
    2. Once found them in filter, then store it in Application Cookie, on the server side.
    3. In the page where the tracking needs to be added, add the JavaScript to check if these Cookies have been set.
    4. If the cookies are set then we called _setCampValue() method, using the Javascript mentioned in the link extga.js
    5. This JS sets the __utmz cookie, which Google Analytic uses for identifying the campaigns.

    Please find the link of blog from which we have taken the javascript to modify the __utmz cookie used by Google Campaigns.

    Thanks.