User Story
As a developer I need to be able to send data to Tealium from a form submission when the form does a redirect (using drupal_goto()) on success.
Problem/Motivation
If I use tealium_add_view_data() or tealium_add_link_data() in a Drupal Form API submit callback and the form has a #redirect property or calls drupal_goto() on success, then the Tealium data is never outputted to a page and is lost.
Proposed resolution
Change the tealium_add_view_data() and tealium_add_link_data() methods to store their data in a SESSION variable, rather than a static variable, so that it persists until the next time a page is delivered to that user.
Also, ensure that when the tealium_add_view_data() and tealium_add_link_data() values are sent, the resulting page is not cached by Drupal.
The drupal_set_message() method is a good example in Drupal core of how this could work.
Remaining tasks
For both tealium_add_view_data() and tealium_add_link_data():
- Update the README documentation to explain the use cases as well as how these methods work, as different from a standard
tealium_add_data()call. - Write Tests that verify data set using with these methods is output on the next returned page when a
drupal_goto()redirect is executed
API changes
Possibly we should rename both tealium_add_view_data() and tealium_add_link_data() as tealium_set_view_data() and tealium_set_link_data().