javascript jquery google translation in website . doesnot translate google map and marker infobox - dictionary

I have included google translation script in our website. The page is automatically translated. But google map and the marker , infobox title is not translated . please help me how to translate google map marker , also some images based on the language selection.
Thanks
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'jp',includedLanguages: 'en,jp', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
}

Related

How to add a separate Analytics for each website page in Wordpress

We have a WordPress installation that has locations as separate pages.
For example: mysite.com/colorado and mysite.com/alabama
We need separate google analytics for each of these as well as 1 for all of mysite.com.
Is there a way to do this with a WordPress plugin(s) or will we need to hand code some things?
Thanks in advance!
If I'm not mistaken, Google Analytics lets you view your analytics in a breakdown like that. That said, if you do need individual scripts, it would be relatively easy to program in. There may be some plugins that do this, but I'm not aware of any in particular, though a cursory glance showed plugins like Header and Footer Scripts that allow you to add scripts on a page by page basis.
Some themes also allow you to add SEO/Script settings per page/post. If that's the case, you can just open up each page and dump each script tag in the "header scripts" or similar section, and call it good. (Genesis is an example of a theme that does this).
If not, programming this would be relatively straight forward. I'd do it something like this:
add_action( 'wp_head', 'display_analytics_by_page', 1 );
function display_analytics_by_page(){
// Default Script Code with individual UA codes replaced
$script = '<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=[UA-CODE]"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag(\'js\', new Date());
gtag(\'config\', \'[UA-CODE]\');
</script>';
// Array of UA codes by state
$codes = array(
'Alabama' => 'UA-123456789-1',
'Oregon' => 'UA-987654542-3',
'Vermont' => 'UA-000000000-0'
);
// Get title of this page
$title = get_the_title();
// If this page title exists in the codes array, swap placeholder and echo it.
if( isset($codes[$title]) ){
echo str_replace( '[UA-CODE]', $codes[$title], $script );
}
}
I commented along the way, but the gist is to put in the "default" script, but pull out the UA code. This will only work if you need the same exact script code in each one, otherwise you'll have to add each script to the $codes array instead.
Then create an array of the UA Codes (or full scripts if needed), keyed by the page title.
Then check the page title, and if that exists, pull that code in and echo it. This is run on the wp_head hook, so you just need to put this code in your functions.php (or similar) file.
If you want to go easy with no-coding, then go with a plugin. Jump to Plugins > Add New and Search for Google Analytics in the search box. Install the plugin named Google Analytics for WordPress (Formerly GADWP). Activate and connect the plugin with your Google Analytics property. When all is done, you will see a new tab beside your post's title. See a screenshot here.
And if you want the net analytics for the whole web site then head to your admin dashboard. A new widget will appear there with the analytics.
Documentation for the plugin can be found here.
I hope it helps.
I'm curious why you need a separate GA account for all the locations? Common practice in this scenario would be:
Use 1 account
Create 1 GA view for the entire domain
Create +1 view for each location by filtering traffic based on the URL
If the different accounts are related to limiting user access, know that you can grant user access based on each property view.

Custom Image on Google Tag Manager (AMP)

I need to add custom scripts to my AMP GTM container.
We have one for a facebook event. For custom image URL we are using https://www.facebook.com/tr?id=[MY_ID]=PageView&noscript=1
I need to do something similar for Pardot.
<script type="text/javascript">
piAId = '123456';
piCId = '123';
piHostname = 'pi.pardot.com';
(function() {
function async_load(){
var s = document.createElement('script'); s.type = 'text/javascript';
s.src = 'https://pi.pardot.com/pd.js';
var c = document.getElementsByTagName('script')[0]; c.parentNode.insertBefore(s, c);
}
if(window.attachEvent) { window.attachEvent('onload', async_load); }
else { window.addEventListener('load', async_load, false); }
})();
</script>
We have other types of tracking that I'd like to have a custom image for so we can do everything in our GTM container.
Is this possible to do the same way I did facebook? Is there a standard way of doing this? Adding query args?
Any help / guidance is appreciated
There is no custom HTML tag in an AMP container, since the use of AMP is restricted in AMP pages in the first place.
AMP pages can’t include any author-written JavaScript. Instead of
using JavaScript, interactive page features are handled in custom AMP
elements.
(Source)
I think you knew that, even though you asked for custom script.
For the real question if you can convert the Pardot script to a custom image tag I do not see any straightforward solution. The linked script reads cookies and HTML parameters and loads additional javascript. Custom images cannot do that (and the AMP container does not have a cookie variable, so you cannot get at the values through GTM).
This really looks like a case for Pardot tech support to see if they have an AMP compatible version of their tag.

Google maps fully zoomed in all the time

I have a wordpress site with WP-bakery(visual composer) and have embedded a google map with an API key. Suddenly the map is fully zoomed in all the time. I try to change the scale in WP-bakery widget but it will not show right on homepage. Ex: www.admemo.net
In your script you should be able to change the zoom value like so :
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 15
});

Google Map on a wordpress site. Can't figure out how to put a customized icon for placemark

I have a wordpress website. I've embedded a map on the contacts page. How can I put a customized logo as a placemark in that map? I am fairly new to this and would like to know how to do this.
Just simply add a div over the map with a customized logo.
Have you added a marker to the map?
You can see the example from Snazzy Map (view source code of their example) https://snazzymaps.com/download-example/1
Then add the url of your customized icon.
var marker = new google.maps.Marker({
position: new google.maps.LatLng(-39, 700),
map: map,
icon: "http://yoursite.com.au/wp-content/uploads/your-marker.png",
title: 'Anything you want!'
});
I am pretty sure there are other ways, but that's how I did mine.

inserting google 'onclick' tracking link attribute in wordpress

I am looking for a way to modify the links on my Wordpress site so it tracks all my 3rd party links.
I was able to find some help with the, how to create the correct tracking code in Google Analytics, but the second part of the process is to add some specific link attributes.
Here is the example which they suggest I replicate:
<'a href="www.blog-hosting-service.com/myBlog" onclick="_gaq.push(['_link', 'www.blog-hosting-service.com/myBlog']); return false;">View My Blog
Does anyone know where I can insert this code link attributes so I can collect the external clicks via Google Analytics?
JQuery would be the best way in my opinion.
// start by getting the current page path (the one you are sending to tracker)
var pathname = window.location.pathname;
// ready handler to change the links on hosts not equal to location host
$(document).ready(function() {
$('a[href^="http://"]').filter(function() {
return this.hostname && this.hostname !== location.hostname;
}).click(function(e) {
_gaq.push(['_link', pathname]);
});
});

Resources