writeCapture2 & Burst Network

37 views
Skip to first unread message

Peter Gibson

unread,
Oct 17, 2012, 8:08:28 AM10/17/12
to writecaptu...@googlegroups.com
I can't seem to get WC2 to work with Burst Network ads.

I get the following unexpected token error, it seems to be trying to evaluate the </SCRIPT> tag as a script itself:
http://jsfiddle.net/HGHF7/

Any help to get that resolved would be great!

Micky Hulse

unread,
Oct 17, 2012, 12:49:22 PM10/17/12
to writecaptu...@googlegroups.com
I changed the WC2 line to this:

writeCapture.write(document.getElementById('top_ad'), '<scr' + 'ipt
type="text/javascript"
src="http://www.burstnet.com/cgi-bin/ads/ad7397a.cgi/v=2.3S/sz=468x60A|728x90A/'
+ rnum + '/' + nf + 'RETURN-CODE/JS/"></scr' + 'ipt>');

When I click "run" and inspect the HTML, I see that "top_ad" div is
getting a script tag with this src:

http://www.burstnet.com/cgi-bin/ads/ad7397a.cgi/v=2.3S/sz=468x60A|728x90A/68783/RETURN-CODE/JS/

Full html output:

<script type="text/javascript"
src="http://www.burstnet.com/cgi-bin/ads/ad7397a.cgi/v=2.3S/sz=468x60A|728x90A/68783/RETURN-CODE/JS/"></script>

I don't know a lot about Burst Network, but is that how the ad calls
are supposed to look? Have you tried the ad without using WC2 to see
if the ad works straight out of the box?

When I visit:

http://www.burstnet.com/cgi-bin/ads/ad7397a.cgi/v=2.3S/sz=468x60A|728x90A/68783/RETURN-CODE/JS/

There's not much there. The strange thing is, it appears as though
it's sending back text/html as the content type of that page... Not
sure if that's a problem?

Sorry I'm not of much more help.

Micky

Peter Gibson

unread,
Oct 17, 2012, 1:14:25 PM10/17/12
to writecaptu...@googlegroups.com
Well after a load of debugging it seems I found the problem.  I'm not sure whether this is the ideal fix but it seems to work for all of my ad networks.  The problem is that Burst Network gives back a script and it ends with </SCRIPT>, it looks like this isn't recognised as the end of the script and so it tries to evaluate this as JScript which obviously fails.  If this was </script> as opposed to </SCRIPT> it would work fine.

My fix was on line 98 of element.write.js (not within writeCapture itself), I changed:
var specialBody = new RegExp("([\\s\\S]*?)<\/" + stack.last() + "[^>]*>");

To:
var specialBody = new RegExp("([\\s\\S]*?)<\/" + stack.last() + "[^>]*>", "i");

Which makes the regex match case-insensitive.  This causes element.write to recognise the ending tag and everything works nicely.

Micky Hulse

unread,
Oct 18, 2012, 2:00:46 PM10/18/12
to writecaptu...@googlegroups.com
On Wed, Oct 17, 2012 at 10:14 AM, Peter Gibson <rvsp...@gmail.com> wrote:
> My fix was on line 98 of element.write.js (not within writeCapture itself),
> Which makes the regex match case-insensitive. This causes element.write to
> recognise the ending tag and everything works nicely.

Nice catch. I wonder if you should submit a patch? Might be useful to
others, and I don't see any reason why it needs to be case sensitive.

Glad you got it figured.

M

noah

unread,
Oct 18, 2012, 9:11:57 PM10/18/12
to writecaptu...@googlegroups.com
I've patched element.write and updated the submodule for WC2. Thanks
for reporting this.

Micky Hulse

unread,
Oct 18, 2012, 9:22:17 PM10/18/12
to writecaptu...@googlegroups.com
Noah...

You seriously ROCK. :)
--
Micky Hulse
Web Content Editor
The Register-Guard
3500 Chad Drive
Eugene, OR 97408
Phone: (541) 338-2621
Fax: (541) 683-7631
Web: <http://www.registerguard.com>
Reply all
Reply to author
Forward
0 new messages