The ad would be before the article on every post / page. I was doing this before also, but that was with the help of the plugin called Ad Injection.
Now, I want to paste some PHP code also, which can't be done by plugin. The code is
echo do_shortcode('[m_geocountry locations="US"] HTML for USA [/m_geocountry] [m_geocountry locations="CA,GB"] HTML for Canada and UK [/m_geocountry] [m_geocountry locations="CA,US,GB" display="0"] HTML for everyone else [/m_geocountry]');
I do not know where to paste this code in the theme template and in which file. Please help me out.