Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 528
Kunal Jha Avatar asked Jul 15 '13 09:07

Kunal Jha


People also ask

What are the differences between Spring MVC and Spring Web Flow?

MVC is an implementation of the Model View Controller design pattern, webflow is an implementation of a "web flow" state machine. Web flow sits on top of springs MVC and allows you to define complex navigational flows.

What is the use of Spring Web Flow?

Spring Web Flow provides a declarative flow definition language for authoring flows on a higher level of abstraction. It allows it to be integrated into a wide range of applications without any changes (to the flow programming model) including Spring MVC, JSF, and even Portlet web applications.

What are the modules of Spring Web Flow?

Spring's web module provides a wealth of unique web support features, including: Clear separation of roles - controller, validator, command object, form object, model object, DispatcherServlet, handler mapping, view resolver, etc. Each role can be fulfilled by a specialized object.


1 Answers

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.

like image 62
Kunal Jha Avatar answered Sep 22 '22 01:09

Kunal Jha