Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 14 Aug 2019, 17:56
alfuzzy alfuzzy is offline
 
Join Date: Jul 2018
Help with Advertising Code

Hello all you experts out there.

I'm working with a new advertising partner...and they provided me with some ad code for a video advertisement. Problem is...the video ad code doesn't seem to include any sizing information...so the video will play full size in whatever window size the browser is running. The larger the browser window...the larger the video ad...the smaller the window...the smaller the window the video will play in. No matter what size the browser window is...this video ad will play full-size in that window.

I would like the video to play at a fixed size (let's say 700px wide)...no matter what size browser window is being used by the user.

Here's the ad code I've been provided...can someone take a look at it...and please modify it with some code that will force it to run in a fixed size window (700px wide for example)...or please let me know what & where some code needs to be added so it runs in a fixed size window.

<script>
(function (d,s,n,id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s);
js.id = id;
js.className = n;
js.src = "https://stream.xyz.com/embed/sdk.js?embedId=333cf05e-c1be-499e-53a2-1234c311fe7d";
fjs.parentNode.insertBefore(js, fjs);
}(document,'script’,’xyz-stream','stream-sdk-jssdk_xyz.com'));
</script>
<div id=“333cf05e-c1be-499e-53a2-1234c311fe7d"></div>


Thanks very much.
Reply With Quote
  #2  
Old 14 Aug 2019, 18:09
z3r0's Avatar
z3r0 z3r0 is offline
 
Join Date: Apr 2005
Location: Lancashire, UK
My Malwarebytes Pro blocks the js source url as a trojan - I'd go nowhere near that ad provider.
__________________
Better VB.org search
Reply With Quote
  #3  
Old 14 Aug 2019, 20:28
alfuzzy alfuzzy is offline
 
Join Date: Jul 2018
Originally Posted by z3r0 View Post
My Malwarebytes Pro blocks the js source url as a trojan - I'd go nowhere near that ad provider.
I modified the source URL on purpose...so as to protect the identity of the supplier of the code & my website...thus any Malwarebytes results are not necessary.

What I need to know is how to augment this code so that the video ad plays in a smaller size fixed space...since at the moment it only plays full screen.

Please modify or let me know how to modify it...and I will repost with the results. Something like 700px wide would work ok.

Thanks
Reply With Quote
  #4  
Old 14 Aug 2019, 20:58
Dave Dave is offline
 
Join Date: Jun 2010
Real name: Dave
You can try giving the div a fixed width/height, but JavaScript can override that so I'm not sure if that will actually work. Generally those ad scripts have options to specify a maximum width/height.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
https://technidev.com - security, development, exploits, vBulletin
dave[at]technidev[dot]com

Contact me for custom vBulletin 3/4 work & server/website management.
Reply With Quote
  #5  
Old 14 Aug 2019, 21:31
alfuzzy alfuzzy is offline
 
Join Date: Jul 2018
Hello Dave...thanks very much for the help.

I tried the modification suggested...but unfortunately the video ad still plays in full screen (full size of the browser window).

Any more suggestions please? I really want to get this working.

Thanks

--------------- Added 14 Aug 2019 at 21:33 ---------------

This is what the full ad code looks like after the modification Dave suggested:

<script>
(function (d,s,n,id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s);
js.id = id;
js.className = n;
js.src = "https://stream.xyz.com/embed/sdk.js?embedId=333cf05e-c1be-499e-53a2-1234c311fe7d";
fjs.parentNode.insertBefore(js, fjs);
}(document,'script’,’xyz-stream','stream-sdk-jssdk_xyz.com'));
</script>
<div id=“333cf05e-c1be-499e-53a2-1234c311fe7d" style=”height: 200px; width: 700px;”></div>
Reply With Quote
  #6  
Old 14 Aug 2019, 22:47
Dave Dave is offline
 
Join Date: Jun 2010
Real name: Dave
Have you tried asking the ad company or checked out their API documentation?
__________________
https://technidev.com - security, development, exploits, vBulletin
dave[at]technidev[dot]com

Contact me for custom vBulletin 3/4 work & server/website management.
Reply With Quote
  #7  
Old 15 Aug 2019, 11:37
alfuzzy alfuzzy is offline
 
Join Date: Jul 2018
Originally Posted by Dave View Post
Have you tried asking the ad company or checked out their API documentation?
Ohh yes definitely. The ad companies tech team has looked into it...but nothing they've suggested thus far has worked. I have a feeling they may not be very familiar working with vBulletin websites.

This is why I was hoping to find a solution from the many experts here at vBulletin.org. If there is a solution...I would think this is the place to find it!

Thanks
Reply With Quote
  #8  
Old 15 Aug 2019, 12:46
Dave Dave is offline
 
Join Date: Jun 2010
Real name: Dave
Well this is not specific to vBulletin though, this is just regarding forcing an ad to specific dimensions. Nearly all ad provider have this feature as part of their JavaScript library or API so you probably should rethink the ad provider you're using now...
__________________
https://technidev.com - security, development, exploits, vBulletin
dave[at]technidev[dot]com

Contact me for custom vBulletin 3/4 work & server/website management.
Reply With Quote
  #9  
Old 15 Aug 2019, 14:18
In Omnibus's Avatar
In Omnibus In Omnibus is offline
 
Join Date: Apr 2010
Real name: Kris
Advertisers set the size of their ads. If you change that you are likely violating your terms of service agreement with them. They usually hardcode the ad size into their JS code because the average user won't know how to set the ad size.

If you want a case-in-point example Google will demonetize your AdSense if they find you are changing the size of their ads on YouTube videos.
Reply With Quote
  #10  
Old 15 Aug 2019, 16:40
alfuzzy alfuzzy is offline
 
Join Date: Jul 2018
Hello Dave & In Omnibus...thanks for the great replies.

Yes I definitely hear you regarding the ad code from ad partners already including size/dimension code within the ad code they supply. I have worked (or am currently working with) at least 5-7 different ad partners...and all of them have included size info in the code they supply.

This includes Adsense, Media.net, Amazon Associates...and others.

I've mentioned this to this specific ad supplier...and up to this point they really haven't offered a solution where the "ad dimension code" is included within the ad code they supply.

What they seem to want me to do is...modify the vBulletin templates so their ads run in a size that's works for my website (modify the ad container size in the vBulletin templates). I really would rather not do this...since this will fix this ad location to just one size ad...and I'm pretty sure (from experience)...that the vBulletin ad locations/containers are responsive (many ad sizes will work).

Also...if I then decide in the future...to work with a different ad partner...or move this specific ad to a different location on the website...then the template that was modified will need to be modified back to it's original unaltered vBulletin code.

This can be done of course...but a lot of unnecessary modifying...since the ad supplier should supply ad code that works without needing to modify templates.

If anyone has any other ideas on how to modify the ad code so it doesn't run full size (full size in the browser window)...that would be awesome!

Thanks again for the help.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 10:03.

Layout Options | Width: Wide Color: