Two dedicated ads in one spot on my app.

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Two dedicated ads in one spot on my app.

Harvey
I currently have one ad that only runs in one spot here:

http://directory.nyskiblog.com/Vermont-Ski-Areas-f5001365.html

I'd like to add another (different) ad that one runs on this page.  Somehow I now have 4 ads - but I only want two. For some reason I am getting duplicates.

Can you help me write this macro so that it shows two different ads on the page above only?

Here is the code I have. I thought this would show two ads not four:


 <override_macro name ="show_custom_ads" parameters="location" requires="servlet" >  
    <n.if.equal value1="[n.location/]" value2="widget">    
        <then>    
            <div class="ad">  
                <n.if.equal value1="[n.page_node.id/]" value2="5001365">    
                    <then>                          
                        <div style="text-align: center; padding-top: 20px;">  
                            <a href="http://www.worthskis.com/" rel="nofollow" target="_blank">  
                            <img src="http://nyskiblog.com/wp-content/uploads/2012/05/Worth-Skis.jpg" alt="Worth Skis" height="200" width="200" />  
                            </a>  
                        </div> 
                        <div style="text-align: center; padding-top: 20px;">  
                            <a href="http://www.worthskis.com/" rel="nofollow" target="_blank">  
                            <img src="http://nyskiblog.com/wp-content/uploads/2012/05/Worth-Skis.jpg" alt="Worth Skis" height="200" width="200" />  
                            </a>  
                        </div>             
                    </then>  
                    <else>  
                        <script type="text/javascript">  
                        google_ad_client = "ca-pub-0156740191883467";  
                        /* Small-Square */  
                        google_ad_slot = "1736553008";  
                        google_ad_width = 200;  
                        google_ad_height = 200;  
                        google_page_url="<n.current_url/>"  
  
                        </script>  
                        <script type="text/javascript"  
                        src="http://pagead2.googlesyndication.com/pagead/show_ads.js">  
                        </script>   
                    </else>  
                </n.if.equal>    
             </div>  
        </then>    
        <else>    
            <n.as_html_comments.location/>
            <n.if.not.regex_matches text="[n.location/]" pattern="app_bottom|topic_bottom|search_top">  
                <then>
                    <div class="ad shaded-bg-color rounded" style="padding:.5em 0">
                        <script type="text/javascript">                          
                            google_ad_client = "ca-pub-0156740191883467";
                            /* Leaderboard */
                            google_ad_slot = "9529659947";
                            google_ad_width = 728;
                            google_ad_height = 90;
                            google_page_url = "<n.current_url/>";
                        </script>
                        <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
                        </script>
                    </div>
                </then>
            </n.if.not.regex_matches>            
        </else>    
    </n.if.equal>   
</override_macro> 
HTTPS Please!
Reply | Threaded
Open this post in threaded view
|

Re: Two dedicated ads in one spot on my app.

Pedro
Fixed the four ads. I will think a way to make it easier for you.
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Two dedicated ads in one spot on my app.

Harvey
Isn't there a way to put an html widget in the sidebar that I can drop ad code into?

A macro for each ad doesn't seem scalable.

maybe in stead of calling the macro "ad_worth" I could give it a more generic name like VT_ad_1 or something.

I just don't understand how NAML works well enough to give guidance on the most elegant way to customize advertising

If ads could be customized to each spot in each app,  my site could produce more revenue.
HTTPS Please!
Reply | Threaded
Open this post in threaded view
|

Re: Two dedicated ads in one spot on my app.

Pedro
As you can see at your show_custom_ads you have macros for each kind of ad. You can use the names you want, you just need to change them at the macro definition and the macro "call":
macro definition: <macro name="name1">
macro call: <n.name1>
Harvey44 wrote
Isn't there a way to put an html widget in the sidebar that I can drop ad code into?
So, you can drop ad code into macro "ad_worth", for example. Or creating new macros.
Harvey44 wrote
If ads could be customized to each spot in each app,  my site could produce more revenue.
Google adsense should do it.
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Two dedicated ads in one spot on my app.

Harvey
Pedro <Nabble> wrote
As you can see at your show_custom_ads you have macros for each kind of ad. You can use the names you want, you just need to change them at the macro definition and the macro "call":
macro definition: <macro name="name1">
macro call: <n.name1>
Harvey44 wrote
Isn't there a way to put an html widget in the sidebar that I can drop ad code into?
So, you can drop ad code into macro "ad_worth", for example. Or creating new macros.
Harvey44 wrote
If ads could be customized to each spot in each app,  my site could produce more revenue.
Google adsense should do it.
Not sure what you mean about Google Adsense.

I tried to change the name of ad_worth but got an error.



I also couldn't find the macro definition or macro call.



If I drop different code into the second ad_worth spot will it change only the second ad unit or will it change both?
HTTPS Please!
Reply | Threaded
Open this post in threaded view
|

Re: Two dedicated ads in one spot on my app.

Pedro
See at the top of this code something like this:
<then>                          
  <n.ad_worth/>
  <n.ad_worth/>
</then>  
If you changed tha macro name, you should also change here like this:
<then>                          
  <n.ad_VT2/>
  <n.ad_VT2/>
 </then>  
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Two dedicated ads in one spot on my app.

Harvey
Thanks this is working, now that I understand it!  
HTTPS Please!
Reply | Threaded
Open this post in threaded view
|

Re: Two dedicated ads in one spot on my app.

Pedro
Try to change the code of ad_VT2 macro, replace with another ad to see what happens.
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Two dedicated ads in one spot on my app.

Harvey
I meant to say all was working fine thanks!
HTTPS Please!