CVS edit link for rcastera

Hello,

My name is Richard Castera and I am a PHP developer. I've been developing PHP applications since 2003 and love what I do! I am currently the Technology Director/Lead Web Developer for a firm (SankyNet) that specializes in Online Fundraising and Marketing for nonprofits.

My background originally stems from the For-profit world of web development and 11 Months ago, I joined this firm because I had a desire to “give back” which in the same vein, the reason for becoming an author and contributor of Drupal Modules and hopefully, eventually Drupal Core.

I've learned a lot about how the Non-profit world works, and how behind they are in terms of technology. I’ve made some significant improvements for some of our clients that are running on Drupal such as (http://www.covenanthouse.org, http://www.ffhtechnical.org, http://greenwichhouse.org) with custom modules that I’ve written that aid them in measuring information about their donors and their behavior.

I have several modules that are currently not on the Drupal site that I would love to submit. My first submission is a Campaign Origin Code tracker. It’s in use on these two websites:
http://www.covenanthouse.org
http://greenwichhouse.org

This module allows the website to accept codes from marketing campaigns VIA the URL and piggybacks them based on the specified days to store them in an administration settings form. A function is provided to store this information when a conversion has occurred such as contact form, email signup, donation form, etc. You can download the modules code here:
http://www.sankyserver.com/campaign_origins.rar

Thank you for your consideration!

Richard Castera
Richard.castera@gmail.com
http://www.richardcastera.com
http://twitter.com/rcastera

Comments

rcastera’s picture

StatusFileSize
new5.34 KB
rcastera’s picture

Status: Postponed (maintainer needs more info) » Needs review
sun’s picture

Status: Needs review » Postponed (maintainer needs more info)

Thanks for applying!

However, how is this module different from already existing community projects? For examples, see

http://drupal.org/project/modules?text=campaign
http://drupal.org/project/modules?text=tracking%20code
...

avpaderno’s picture

Status: Postponed (maintainer needs more info) » Needs work
rcastera’s picture

Hello,

This module is different then the above mentioned modules in a number of ways. It works independently of specific platforms or services such as Campaign Monitor, Mailchimp, etc which not all Non-profits utilize, primarily because these services are not entirely free. Additionally, these modules do not track the entire history of a user. They only record a single referring address or clicks on a page.

My proposed module offers a unique approach to tracking by focusing on the user's path to conversion through implementing URL queries that any user can utilize. If they can build an anchor, they can use this module.

Here is an example of one of the many ways this can be utilized:

A Non-profit sets up an email newsletter, which brings the user to a landing page, and eventually to a donation form. The goal of this module would be to record the origin point of a successful conversion, in this case the original email newsletter.

To initiate tracking of the user's path throughout the site, one simply needs to add a query string to the first link in the email newsletter. Ex: http://www.domain.com/?origin=code. When the user hits the landing page this code gets stored in a cookie and concatenates any additional codes. Finally, it is added to the database when a conversion is made, so this record is available for reporting.

A major benefit of tracking in this method is to realize what it is about a single email newsletter, or landing page, or referring website that so successfully converts browsing users to donors and then replicate that experience.

Best,
Richard

rcastera’s picture

Status: Needs work » Needs review
rcastera’s picture

Hello,

Was wondering if you had a chance to review my last comment.

Thanks!

rcastera’s picture

Please review.

sun’s picture

Status: Needs review » Needs work
  1. version = 1.00
    shouldn't be contained in the .info file.
  2. /**
     * @package		Analytics
     * @uses        Install the schema for origin tracking
     * @link		http://www.sankyinc.com/
     * @author		Richard Castera http://www.richardcastera.com
     * @date		06/08/2010
     * @copyright 	Sanky Communications 2010  Copyright.
     * @version		1.00
     * @access      Public
     * @license     GPL
     **/
    

    We don't do such file headers in Drupal. See http://drupal.org/node/1354 for Drupal's Doxygen and documentation standards.

    @package is defined via .info file already.
    @uses is completely used wrong here.
    @link also wrongly used here.
    @version and @date are needless, auto-generated and injected into .info file already.
    @license is superfluous, all code hosted and distributed on drupal.org is GPLv2.
    @access wrongly used here.
    We don't do @copyright and @author in Drupal.

  3. /**
     * @uses        Implementation of hook_install()
     * @param	    None. 
     * @return      None.
     * @comments    Installs the schema for campaign_origins.
     **/ 
    

    Also wrong function headers. @uses and @comments are bogus. @param and @return is not documented for module hook implementations. Also note that your multi-line comment syntax (at the end) is bogus. More details in above mentioned documentation standards handbook page.

  4. function campaign_origins_install() {
      variable_set('campaign_origin_expiration', 7);
    

    You need to decide whether your namespace is campaign_origins (plural) or campaign_origin (singular). As of now, most of the module is plural. That means there shouldn't be a variable (or anything else) in the singular namespace.

    Note that you should not set variables in hook_install(). Your code should use default values for not configured variables instead.

  5. You should run this module through Coder module, http://drupal.org/project/coder
  6. /** Include dependent files. **/
    if(file_exists(drupal_get_path('module', 'campaign_origins') . '/class.campaign_origins.inc')): 
      require('class.campaign_origins.inc');
    endif;
    

    There should not be code executed in the global scope. drupal_get_path() might not be available yet. You can move this into hook_init(). Make sure you use http://api.drupal.org/api/function/module_load_include/6 instead.

  7. function campaign_origins_init() {	
      if(class_exists('CampaignOrigins')){
        $tracking = new CampaignOrigins();
        $tracking->setExpiration(variable_get('campaign_origin_expiration', 7));
        $tracking->track();
        unset($tracking);
      }
    }
    

    Looking at this and looking at the class, implementing this entire functionality in OOP is 99% overhead. The entire module could be stripped down to a few lines of code by removing all of the needless overhead.

  8. campaign_origins_add_origin() is not invoked from anywhere. I'm not sure how this module is supposed to work.
  9. function campaign_origins_admin_settings_form() {
      $form['campaign_origins_settings'] = array(
        '#type'=>'fieldset',
        '#title'=>t('Enter a number representing the number of days the cookie will expire. Example: 7')
      );
    

    You should only use fieldsets where it's technically necessary to group form elements.

  10.   $form['sanky_twitter_credentials']['submit'] = array(
        '#type'=>'submit',
        '#value'=>t('Submit')
      );
    

    Strange first key here.

  11.   if(($form_state['values']['cookie_days'] == '') || (!is_numeric($form_state['values']['cookie_days']))) {
    

    Not sure whether this sufficiently validates that the entered value is an integer.

  12. function campaign_origins_admin_settings_form_submit($form, &$form_state) {
      variable_set('campaign_origin_expiration', $form_state['values']['cookie_days']);
      drupal_set_message(t('Cookie Expiration updated!'), 'status');
    }
    

    You wouldn't need that form submit handler, if you'd use http://api.drupal.org/api/function/system_settings_form/6 - there are many examples in core and contrib for how to use it.

rcastera’s picture

StatusFileSize
new3.78 KB

Hello Sun,

Thank you for all of your direction and suggestions. I've updated the module and hope you can review it again. The Campaign Origins module is geared toward usage by developers and site builders. It is not intended to be used by the general audience so that's why it does not invoke any hooks. It provides a function call for the programmer to call to document the conversion.

Thanks!
Richard

avpaderno’s picture

Status: Needs work » Needs review

Remember to change status, when you upload a new version of the code.

rcastera’s picture

StatusFileSize
new3.78 KB

@kiamlaluno, Thank you! I've re-commented and re-uploaded it again for review.

rcastera’s picture

Please review.

rcastera’s picture

Please review.

avpaderno’s picture

Status: Needs review » Needs work
  • The points reported in this review are not in order of importance / relevance.
  • Most of the times I report the code that present an issue. In such cases, the same error can be present in other parts of the code; the fact I don't report the same issue more than once doesn't mean the same issue is not present in different places.
  • Not all the reported points are application blockers; some of the points I report are simple suggestions to who applies for a CVS account. For a list of what is considered a blocker for the application approval, see CVS applications review, what to expect. Keep in mind the list is still under construction, and can be changed to adapt it to what has been found out during code review, or to make the list clearer to who applies for a CVS account.
  1. Menu descriptions and titles, as well as schema descriptions, are not passed to t(). Schema descriptions should then more descriptive than id.
  2. See http://drupal.org/coding-standards to understand how a module should be written. In particular, see how the code should be formatted.
  3.     if(arg(0) == 'node' && is_numeric(arg(1))) {
          $node = node_load(arg(1));
        }
    
    

    The code should probably use menu_get_object().

  4. The file README should be renamed README.txt.
avpaderno’s picture

Status: Needs work » Closed (won't fix)

I am closing this application due to lack of replies.

rcastera’s picture

Status: Closed (won't fix) » Active

I am modifying this module and also developing others. I will post an update shortly. Thanks!

avpaderno’s picture

Status: Active » Closed (won't fix)

Please re-apply for a CVS account; this report has been left without a reply for two months, and it has been declined. Changing the status of this report doesn't change the status of the application.

avpaderno’s picture

Component: Miscellaneous » new project application
Issue summary: View changes
Status: Closed (won't fix) » Closed (duplicate)
Related issues: +#769542: rcastera [rcastera]