Display Ad in website From Revive Ad Server - openx

I have installed Revive Ad server on my server. I have created advertiser, banners, campaign, websites, zones and liked banners and finally I generated invocation code in javascript.
This is the invocation code for a 300*50 sized banner::
<script type='text/javascript'><!--//<![CDATA[
var m3_u = (location.protocol=='https:'?'https://republica.bajratechnologies.com/revive/www/delivery/ajs.php':'http://republica.bajratechnologies.com/revive/www/delivery/ajs.php');
var m3_r = Math.floor(Math.random()*99999999999);
if (!document.MAX_used) document.MAX_used = ',';
document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
document.write ("?zoneid=1&withtext=1");
document.write ('&cb=' + m3_r);
if (document.MAX_used != ',') document.write ("&exclude=" + document.MAX_used);
document.write (document.charset ? '&charset='+document.charset : (document.characterSet ? '&charset='+document.characterSet : ''));
document.write ("&loc=" + escape(window.location));
if (document.referrer) document.write ("&referer=" + escape(document.referrer));
if (document.context) document.write ("&context=" + escape(document.context));
if (document.mmm_fo) document.write ("&mmm_fo=1");
document.write ("'><\/scr"+"ipt>");
//]]>--></script><noscript><a href='http://republica.bajratechnologies.com/revive/www/delivery/ck.php?n=ad68e8df&cb=INSERT_RANDOM_NUMBER_HERE' target='_blank'><img src='http://republica.bajratechnologies.com/revive/www/delivery/avw.php?zoneid=1&cb=INSERT_RANDOM_NUMBER_HERE&n=ad68e8df' border='0' alt='' /></a></noscript>
I have included this tag in my website, but it displays nothing. I removed noscript tag and again run the code, but nothing change occurred. I inserted random number 123 on INSERT_RANDOM_NUMBER_HERE section, nothing is displayed in this case too.
How to display ad in website using this invocation code?

It's probably because your browser has ad block turned on. If you turn it off, it should display.

Related

wordpress ajax pagination with history

(premise: this is a pretty noob question)
Hi guys,
I am try to code a good ajax navigation/pagination for WordPress.
Currently I am trying to append the new page articles instead of replacing the old ones.
In archive.php I've replaced <?php the_posts_navigation(); ?> with
<nav class="navigation posts-navigation" role="navigation">
<div class="nav-links">
<div class="nav-previous">
<?php next_posts_link(); ?>
</div>
</div>
</nav>
since I want to display only the "Next page" link (which I will style in a button later).
And in my js file I have
$('.nav-previous a').live('click', function(e){
e.preventDefault();
$('.navigation').remove(); // Removing the navigation link at the bottom of the first articles
var link = $(this).attr('href');
$.get( link, function(data) {
var articles = $(data).find('.archive-container');
$('#primary').append(articles);
});
});
It is not that clear to me how to implement history handling in a context like this. I'd like to give users the possibility to scroll up to previous results when clicking on the back button and to keep the results when someone clicks on an article and then goes back to the results.
Now, if I use something like window.history.pushState('', '', link); at the end of the click function above, it changes the URL when pushing the link to see the next articles. And this is correct. But, if I click on an article (e.g. of /page/2) to see it and then I click on the back button, it shows only the results of the page containing that article (that is /page/2 in my example). I'd like to show again all the articles the user saw before leaving the archive page instead.
At the moment I'm also working with window.localStorage to reach the goal, but I'd like to understand if it could be feasible only with history and how to do it.
console.log(window.location.href);
let loc = window.location.href.slice(0, -1);
let ppos = loc.indexOf("page/");
if((ppos >= 0)) {
let page = parseInt(loc.slice(loc.lastIndexOf('/') + 1, loc.length)) + 1;
loc = loc.slice(0, ppos) + 'page/' + page + '/';
} else {
loc += '/page/2/';
}
console.log(loc);
window.history.pushState('', '', loc);

jquery load variable won't load contents

Hi I am using jQuery load to grab a ahref from a link and then I want to load a div from the page im getting into a div so have tried this:
// lets load the contents
$('#navigationLinks a:not(:first-child)').click(function(event){
$('#wrapper').animate({
'left':'0px'
});
var href = $('#navigationLinks a').attr('href');
$('#content').load(href + ' #resultDiv');
event.preventDefault();
});
This is the HTML:
<div id="navigationLinks">
Dashboard Home
Industry Overview
Regions
Industries
Security Pipeline
Audit Events & Issues
Account Filter
Contractual vs. Delivered Services
</div>
I tried removing the space in ' #resultDiv' before the # but that didn't help, any help would be greatly appreciated.
You should try this
$(document).ready(function(){
$('#navigationLinks a:not(:first-child)').click(function(e){
var href = e.target;
$('#content').load(href + ' #resultDiv');
e.preventDefault();
});
});
The problem was that var href = $('#navigationLinks a').attr('href'); will always get the first link in the block and not the actually link that was clicked.

Tracking external links with Google Analytics trackPageview() not working

I have set up external link tracking as Goals in Google Analytics according to the GA documentation.
Here is the page in question: http://playmoreatthey.org/ - the external links on the page are formatted such as
Bayside Family YMCA
I set up the goal as a "head match" to the URL: /G1/bayside_family.com
I checked back four days later, and there are no results in the goals or pageviews for the phony "pagename" (/G1/bayside_family.com) specified in the JavaScript attached to each external link.
Looks like on your page you are using GA's async style code _gaq.push(...) but in your onclick you are using their old, "traditional" style code. You need to use
onclick="_gaq.push(['_trackPageview','/G1/bayside_family.com']);"
If you are using jQuery you can automatically track all the links on your site using this script:
// Outbound Link Tracking with Google Analytics
// Requires jQuery 1.7 or higher (use .live if using a lower version)
$("a").on('click', function(e){
var url = $(this).attr("href");
if($.trim(url).indexOf("javascript:") == 0) return;
if (e.currentTarget.host != window.location.host) {
_gaq.push(['_trackEvent', 'Outbound Links', e.currentTarget.host, url, 0]);
var target = $(this).attr("target");
if (e.metaKey || e.ctrlKey || target == "_blank") {
var newtab = true;
}
if (!newtab) {
e.preventDefault();
if(target) {
setTimeout('window.open("' + url + '", "' + target + '");', 100);
} else {
setTimeout('document.location = "' + url + '"', 100);
}
}
}
});
I found the script here: http://wptheming.com/2012/01/tracking-outbound-links-with-google-analytics/comment-page-1/#comment-39716
At the site you can find a debug version that will let you confirm that the script is working correctly.
I deviated from the original script by adding support for links with javascript (aka href="javascript:..."). Also I added code to honor the target attribute.
Here is a jsFiddle so you can see the script in action: http://jsfiddle.net/luisperezphd/45NPe/
One recommended way of doing this is through Events. That way your pageviews metric will not be inflated by the virtual pageviews tracked using the _trackPageview method.
http://support.google.com/analytics/bin/answer.py?hl=en&answer=1136920
I add this as an answer because Crayon Violent's comment above contains a broken link. At least someone will be able to edit this answer if the link needs to change again in the future.

Use Google Analytics (Asynchronous version) to track outgoing clicks without breaking target=_blank

I want to track users clicking links to external sites. I'm happy to use the asynchronous version of GA as this allows (in most browsers) the page to continue loading instead of halting at the script tag and waiting for google-analytics.com/ga.js to download and execute.
Google recommends this function:
<script type="text/javascript">
function recordOutboundLink(link, category, action) {
try {
var myTracker=_gat._getTrackerByName();
_gaq.push(['myTracker._trackEvent', ' + category + ', ' + action + ']);
setTimeout('document.location = "' + link.href + '"', 100)
}catch(err){}
}
</script>
<a href="http://www.example.com" onClick="recordOutboundLink(this, 'Outbound Links', 'example.com');return false;">
The problems with this solution:
It could take 10ms, it could take 300ms for the event to be tracked, but it'll change the page after 100ms no matter what happens. And if the tracking is too slow the page will change before it's been tracked.
document.location = means the original link is ignored and therefore target=_blank does not open new tabs/windows.
Possible solutions:
Busy wait (do {curDate=new Date();} while(curDate-date<millis)) for 100ms while the tracking has a chance to send it's request off then return true. Bad because busy waiting consumes all CPU available.
Use window.open so that new tabs/windows can be opened, which leads me to my current favourite:
In the click handler use $(this).attr("target", "_blank"); and then just return true after pushing the tracking command onto _gaq.
This works because open a new tab leaves the current one to finish executing the tracking call.
$(document).ready(function(){
var localserver = document.location.hostname;
// unfortunately misses if any uppercase used in link scheme
$("a[href^=http://],a[href^=https://]")
.not("a[href^=http://"+localserver+"]")
.not("a[href^=http://www."+localserver+"]")
.click(function(e){
$(this).attr("target", "_blank");
_gaq.push(['_trackEvent',
'Outgoing Click',
$(this).attr("href"),
$(this).text()
]);
return true;
});
});
With the one small downside of always opening a new tab for external links, I can't see any other problems.

JW Player: cross-browser "display:none" player behavior

Is there a simple, upfront method to have FF and IE treat hidden JW Players the same?
I am placing different instances of the player dynamically in jQuery generated tabs. In effect, switching tabs hides the parent div of each player. In FireFox, the tab switch and accompanying "display" change stops the player. This doesn't happen in IE. I would like it to.
What is the easiest way to have both browsers act the same? I am hoping for a CSS/HTML solution, either thorough the way the players are embedded or a style rule Otherwise I suppose I will need to add an item listener that compares the currently selected tab id to currently active players... but I'd rather not go that route.
Thanks for your tips!
EDIT: So, I'd rather be able to change the player CSS or markup on tab change than send stop events to all the players but the player in the currently active tab.
This is an issue with Internet Explorer. While FF, Chrome, and Safari will kill Flash, IE doesn't. The only way we've been able to ensure that the player stops is to keep track of all active players on the page and call stop.
Best,
Zach
Developer, LongTail Video
If you're using JavaScript to change tabs, why are you hoping for a pure CSS/HTML solution for your problem?
I think you have to use JavaScript.
Take a look at the JW Player API:
http://developer.longtailvideo.com/trac/wiki/Player5Api
You can call the stop() method on the player.
player.stop();
Sorry my friend. I've a big trouble that doesn't make me sleep...
I've a site with:
- a div with a video (jwplayer)
- a div with a gallery (lightbox, on click popover of image)
If video play and a user (only with IE) click on a image, the popover appears over video, the video continues to play (ok!) but video goes blank!
When I close image popover, video timeline play normally but video is still blank (all black).
I've been try to use what you wrote here but without success.
This is the script I must use to insert jwplayer.
<div id="Player">player should load here</div>
<script language="javascript" type="text/javascript">
var flashvars = {};
flashvars.linkfromdisplay = "true";
flashvars.autostart = "false";
flashvars.height = "' . $h . '";
flashvars.controlbar = "over";
flashvars.width = "' . $w . '";
flashvars.repeat = "false";
flashvars.bufferlength = "5";
flashvars.displayheight = "' . $h . '";
flashvars.displaywidth = "' . $w . '";
flashvars.file = "http://blablabla.com";
flashvars.type = "vdox";
flashvars.provider = "vdox";
var params = {};
params.menu = "true";
params.allowscriptaccess = "always";
params.allowfullscreen = "true";
params.wmode = "transparent";
params.windowless="true";
var attributes = {};
attributes.id = "Player";
attributes.name = "Player";
swfobject.embedSWF("' . get_bloginfo("template_directory") . '/embed/mediaplayer.swf", "Player", "' . $w . '", "' . $h . '", "8","expressInstall.swf", flashvars, params, attributes);
</script>
I tried also to stop via js video before open popover (player1.sendEvent('STOP');): video stops, but if I click on play button, remains black.
I tried also to remove video element via jquery, saving it in a variable. Then I insert a button "restore video": in Chrome works, in IE reappear video object, it play but all black.
Thanks

Resources