The AdRoll Smartpixel Integration module is a simple module for integrating adroll smartpixel js into your drupal pages without touching code. All you need are the Advertisable ID and the Pixel ID from AdRoll.
This is helpful for non coders as they will not have to worry abut where they can add their AdRoll Smartpixel js to be included on every page of their site. Instead, by using this module they can simply
* download and install module
* add the required Advertisable ID and the Pixel ID form AdRoll - to the their site - through the admin configuration page of this module : admin/config/search/adroll
* with both the above keys supplied, the module will add the required js to every non-admin page on the site

Reviews of other projects

  1. https://drupal.org/node/2204535#comment-8835565
  2. https://www.drupal.org/node/2159747#comment-9113285

Comments

PA robot’s picture

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

SGhosh’s picture

Issue summary: View changes
skh’s picture

A few minor things:

  • You have some pareview errors,
  • The code in the description for cloning the repository is for your personal d.o account, it should be git clone --branch 7.x-1.x http://git.drupal.org/sandbox/SGhosh/2270117.git,
  • Consider adding the information in the read me to your project's overview page,
  • You do not need version = 7.x-1.0 in your .install file (as per #542202).
artsakenos’s picture

Hello SGosh,
thank you for your contribution.
First of all i’d like to say that Drupal blocks and boxes in full html configuration already allow to paste the Smartpixel script without actually coding, rather just changing the personal parameters. This being said, i report some consideration to review the module:

  • The git clone command must be:
    git clone --branch 7.x-1.x git.drupal.org:sandbox/SGhosh/2270117.git adroll_smartpixel_integration
    Your userid must be removed, and also you would directly create the module folder with the correct name.
  • Please refer to this useful template to the compile the README.TXT file according to the guidelines.
  • It would be nice to see in the description of your module a link and a brief tagline about the Adrool service or the Smartpixel code snippet.
  • Consider moving the admin panel hooks inside a .admin.inc file, keeping only the core inside the module (the variable settings).
  • Documentation is incomplete in some case (e.g., Stores the …), please check.

Cheers,
A.

SGhosh’s picture

Issue summary: View changes
SGhosh’s picture

Hey @skh,

Thanks for taking out the time and reviewing my module :)

Replies inline -

You have some pareview errors,

Fixed and commited them to the repo. Here a run of the tests again - http://pareview.sh/pareview/httpgitdrupalorgsandboxsghosh2270117git

The code in the description for cloning the repository is for your personal d.o account, it should be git clone --branch 7.x-1.x http://git.drupal.org/sandbox/SGhosh/2270117.git,

Updated.

Consider adding the information in the read me to your project's overview page,

But currently the module is sandbox. Should I not add this information after I have a full project page for this?

You do not need version = 7.x-1.0 in your .install file (as per #542202).

Removed.

SGhosh’s picture

Hey artsakenos,

thanks a lot for you feedback :)

First of all i’d like to say that Drupal blocks and boxes in full html configuration already allow to paste the Smartpixel script without actually coding, rather just changing the personal parameters.

Yes that is a possible solution, but even with that user can place blocks only in a given list of regions as defined by their theme. Smartpixel requires the js to be added just before the closing body tag, as in here, under 'Summary'
Hence, this module, to ensure the js is added in the html as specified by adroll smartpixel.

The git clone command must be:
git clone --branch 7.x-1.x git.drupal.org:sandbox/SGhosh/2270117.git adroll_smartpixel_integration
Your userid must be removed, and also you would directly create the module folder with the correct name.

Fixed.

Please refer to this useful template to the compile the README.TXT file according to the guidelines.

Updated. Thanks, really good template to follow, did not know about it.

It would be nice to see in the description of your module a link and a brief tagline about the Adrool service or the Smartpixel code snippet.

Added a brief about the AdRoll Smartpixel along with a link to the site, and also some information about the way to configure the module.

Consider moving the admin panel hooks inside a .admin.inc file, keeping only the core inside the module (the variable settings).

Moved the callback to an .inc file. Thanks for pointing this out.

Documentation is incomplete in some case (e.g., Stores the …), please check.

I have updated both the README file as well as the documentation on the module page.

Thanks again for your time. Some really good improvements in my module now from your feedback :)

rob.barnett’s picture

Automated Review:
I ran your code through Code Sniffer and did not find any issues.

Manual Review:
You should be using Drupal.behaviors to call your javascript. See https://www.drupal.org/node/304258
You may want to add a hook_help. This would be useful for site builders who may not be looking at the README.txt.
You may also want to add a link to AdRoll in your README.txt and hook_help
It's also nice to include configure in your .info file: configure = admin/config/search/adroll. This will add a configure link on the modules page which is is nice.

tkuldeep17’s picture

Manual Review

By looking into code I found two doubts. May be my doubts are silly.. :-)

  • You are taking two inputs from user adroll_smartpixel_integration_adv_id and adroll_smartpixel_integration_pix_id, but could not found that where are you using these. In js file you are just reading these values, not used.
  • Are these required fields or not. If yes then you should specify in configuration form.
tkuldeep17’s picture

Status: Needs review » Needs work
SGhosh’s picture

Hey hurley,

thanks a ton for the review and the valuable suggestions. Please find my replies inline -

You should be using Drupal.behaviors to call your javascript. See https://www.drupal.org/node/304258

The Js is supposed to go directly into the html body as per AdRoll instructions. However since I wanted to put the JS through JS file, hence I put the exact JS directly into the JS file. Also, Drupal.behaviors is used mostly to re-add JS code to html loaded through ajax, however this code is supposed to go into the element and only once, I did not think there would be any requirement of a re-addition on any ajax load. Yet, do you think Drupal.behaviors should be the right way of doing it? What advantage will I get from using it?

You may want to add a hook_help. This would be useful for site builders who may not be looking at the README.txt.

Added almost the same data as I have in my README.txt.

You may also want to add a link to AdRoll in your README.txt and hook_help
It's also nice to include configure in your .info file: configure = admin/config/search/adroll. This will add a configure link on the modules page which is is nice.

Added.

SGhosh’s picture

Status: Needs work » Needs review

Hey tkuldeep17 ,

thankyou so much for reviewing my module :). Please see the code below to see where I am using the settings data -

function adroll_smartpixel_integration_init() {
  // Add AdRoll js only on non admin pages.
  if (arg(0) != 'admin') {
    $adroll_adv_id = variable_get('adroll_smartpixel_integration_adv_id', '');
    $adroll_pix_id = variable_get('adroll_smartpixel_integration_pix_id', '');
    // Add the AdRoll js only if the required IDs have been provided.
    if ($adroll_adv_id && $adroll_pix_id) {
      drupal_add_js(
        array(
          'adroll_smartpixel_integration' => array(
            'adroll_adv_id' => $adroll_adv_id,
          ),
        ),
        'setting'
      );
      drupal_add_js(
        array(
          'adroll_smartpixel_integration' => array(
            'adroll_pix_id' => $adroll_pix_id,
          ),
        ),
        'setting'
      );
      drupal_add_js(
        drupal_get_path('module', 'adroll_smartpixel_integration') .
        '/adroll_smartpixel_integration.js',
        array('scope' => 'footer', 'weight' => 1000)
      );
    }
  }
}

As you can see above, in my init function, I am fetching the settings data and if and only if both provided, adding the relevant js file for adroll integration and also passing the settings data to the js file for use in the adroll js code.

Please let me know if you have any more questions. Once again, thanks for the review :)

tkuldeep17’s picture

hi SGhosh,

Thanks for clearing my doubt, but I should have cleared my question. so I am updating... with my new doubt.. :-)
Actually I am not able to see use of these variables in js file. You are reading these values here

adroll_adv_id = Drupal.settings.adroll_smartpixel_integration.adroll_adv_id;
adroll_pix_id = Drupal.settings.adroll_smartpixel_integration.adroll_pix_id;

But where you have used in js file.

and also update your git url, it should be
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/SGhosh/2270117.git adroll_smartpixel_integration

SGhosh’s picture

Hey tkuldeep17,

thanks for the quick reply. Please see the php and js code below -

$adroll_adv_id = variable_get('adroll_smartpixel_integration_adv_id', '');
$adroll_pix_id = variable_get('adroll_smartpixel_integration_pix_id', '');
...
drupal_add_js(
        array(
          'adroll_smartpixel_integration' => array(
            'adroll_adv_id' => $adroll_adv_id,
          ),
        ),
        'setting'
      );
      drupal_add_js(
        array(
          'adroll_smartpixel_integration' => array(
            'adroll_pix_id' => $adroll_pix_id,
          ),
        ),
        'setting'
      );

A you can see above I am passing the 2 variables to js - adroll_adv_id and adroll_pix_id. And below is the Js code where I am accessing these variables.

adroll_adv_id = Drupal.settings.adroll_smartpixel_integration.adroll_adv_id;
adroll_pix_id = Drupal.settings.adroll_smartpixel_integration.adroll_pix_id;

I hope I was able to clear your doubt this time :)

SGhosh’s picture

Issue summary: View changes

@tkuldeep17, also updated the git clone command in the my description. Thanks!

SGhosh’s picture

Issue summary: View changes
klausi’s picture

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

Sorry for the delay. Make sure to review more project applications and complete your review bonus and this will get finished faster.

The project page says "Maintenance status: Unsupported", are you still pursuing this project application? Feel free to update the project page and set this back to "needs review" if you still want to publish this.

SGhosh’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

+klausi, recently I came across this fantastic module - Tracking Code. It allows you to add any js code to the body and even specify whether you want it in head, just after the starting body tag or just before the closing body tag. Not only that, you can also specify the pages you want the code on.
Hence, that module will satisfy not only this requirement(ie. placing alexa code in the html) but also any other such js code placement requirement. So it was only intelligent on my side to stop working on this module and if I have some ideas maybe contribute to that module itself. After all we are aiming for collaboration over competition, right?! :)

Closing this in favour of Tracking Code.

avpaderno’s picture

Status: Closed (duplicate) » Closed (won't fix)
Issue tags: -Third party JS Integration