I know this isn't API related but maybe since it's a developers forum, I'd have a better chance getting a solution?
When doing call tracking you can dynamically replace the phone number on a web page with the Google forwarding number. It required adding an onload function to the body tag. The problem is, I'm using a Wordpress site so it's not straightforward but there are ways around that I know. The REAL problem is I have a dozen pages all with different phone numbers that need to be replaced so I need to customize the script with the phone number to be replaced for that page.
So I tried this. I put the required code in the head:
<script type="text/javascript">
var callback = function(formatted_number, mobile_number) {
var e = document.getElementById("number");
e.innerHTML = "";
e.appendChild(document.createTextNode(formatted_number));
};
</script>
And then instead of using:
<body onload="_googWcmGet(callback, '0800-123-4567')">
<span id="number">0800-123-4567</span>
</body>
I'm using:
<body>
<span id="number">0800-123-4567</span>
<script type="text/javascript">
window.onload = _googWcmGet(callback, '0800-123-4567');
</script>
It errors out with _googWcmGet being undefined. Think this is due to my lack of knowledge of JS/DOM stuff and that I need to cal _googWcmGet outside the body tag some other way?