Hi, I'm experimenting with the Dart module and so far it ticks all the boxes for Doubleclick integration. Ideally I'd like to load the document.writes later so it doesn't block the loading of the page if the adserver is slow and I noticed you'd implemented the WriteCapture plugin. I'm having some trouble enabling it successfully and was hoping for some guidance as I couldn't find any documentation.

So far I've downloaded the library, put it in the correct location: sites/all/libraries/writecapture/jquery.writeCapture.js
I've enabled Dart, created a block and placed it on a page. The block loads and displays an advertisement fine.
Then I activated the load last functionality by adding $conf['dart_load_last'] = TRUE; to my settings.php file.
After this I get the following errors in console: Drupal.DART is undefined and Drupal.DART.settings.loadLastTags is undefined

Is there anything else I need to do? Anything I need to modify?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bleen’s picture

Category: support » bug

There seems to be a few problems with the "load last" functionality .. not the least of which is the missing checkbox to toggle it on/off. Additionally, when it is checked, the dart.js is being loaded after the inline js that dart includes - which is the cause of the specific error you are seeing.

In any case, I'm banging on this one right now. I cant fathom how things got this messed up though...

bleen’s picture

Title: How to use dart_load_last properly? » dart_load_last option is borked
bleen’s picture

Status: Active » Needs review
FileSize
4 KB

this should fix it ... any chance you can test out this patch and confirm?

tanc’s picture

That patch didn't quite work because the classes array on the dart block wasn't correctly defined so the js couldn't grab the name properly. I've attached an updated patch which works for me. Thanks!

tanc’s picture

Been using my patch in #4 for a couple of days now with no errors so its all looking good!

bleen’s picture

I've added a bunch of the coding standards fixes you included in your patch (thanks!) but I'm not seeing why this is needed:

+++ b/dart.moduleundefined
@@ -563,7 +564,7 @@ function _dart_get_page_key_vals() {
-  $variables['attributes_array']['class'] = 'dart-tag dart-name-' . $tag->machinename;
+  $variables['classes_array'][] = 'dart-name-' . $tag->machinename;

I have a basic D7 install with one ad (loading last) and everything appears fine:
Welcome to d7 | d7

Can you explain a bit more the issue you are having with this patch as-is

bleen’s picture

FileSize
5.66 KB

oops .. forgot patch

tanc’s picture

Hmm... Thats odd because when my blocks are rendered $variables['attributes_array']['class'] doesn't output the class in the html, while $variables['classes_array'][] works just fine. I'm trying to think why that might be. Could it be theme related? I'm using Omega on this test site and Context to place the blocks.

tanc’s picture

Looking at template_preprocess_block it looks like classes_array is the standard way of adding additional classes. I could very well be mistaken and I have to say I'm not testing this on a fresh install with the default theme.

bleen’s picture

Status: Needs review » Fixed

for now I went ahead and committed #7 to 7.x-2.x-dev ... if you can make a more compelling argument for the change to how classes are displayed in the tpl please reopen

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

scottatdrake’s picture

The $variables['attributes_array']['class'] thing was a problem for me, too. I had to use $variables['classes_array'][] to get them to display. See http://drupal.org/node/1526442#comment-5856726