Partners
2.8K members online now
2.8K members online now
Ask questions about badging, the Partners portal, and anything related to your Partners account.
Guide Me
star_border
Reply

Dynamic Partner Badge Not Working

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I'm trying to get the dynamic partner badge to show up on our WordPress site, but all I'm getting are errors.

I added:

 

<script src="https://apis.google.com/js/platform.js"></script>

Into the <head> of the site, and then placed:

 

 

<div class="g-partnersbadge" data-agency-id="xxx"></div> 

Into the body. No badge shows up, but I do get the following two JS errors in Chrome:

 

 

GET https://content-partnersbadge-pa.googleapis.com/v1/companies/xxx?key…xxx&language=en&referrer=http%3A%2F%2Fsponsoredlinx.crankit.com.au 404 ()
- cb=gapi.loaded_0:110

[  3.279s] [partners.badge.PartnersBadge] No valid response from API call.
- badge_compiled.js:33

 

I tested the Badge code in a simple HTML page and it works fine, so obviously something in the WordPress site is interfering with it somehow. I tried placing the <script> tag in different places in the <head> and also in the <footer>, but it didn't make a difference. I tried deactivating every plugin (except ACF Pro, as the page broke when I did) and I still received the errors.

Does anyone have any ideas about what's going on and how to fix it?

 

(note: I replaced our agency ID with 'xxx' for this question.)

 

 

 

 

2 Expert replyverified_user

Dynamic Partner Badge Not Working

Top Contributor
# 2
Top Contributor

Hi @Matt K,

 

You need to keep all of the coding together and place it in the body where you want it to show, just as you would a coded paragraph. Do not break it up. 

 

Give that a try and see what happens. Be sure to save the changes and refresh the page a few times.

 

Kind Regards,

 

James

_________________________________________________________
Google AdWords Top Contributor | Google Partner | GYBO | Local Guide | My Profile


 


 


 

Dynamic Partner Badge Not Working

[ Edited ]
Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Hi @James_Clemens, I have tried that. I tried placing both the <script> and the <div> together, both within a wrapper (<div>, <p> and <span>) and without. I even removed the break and space between them so they were on one line.

I hard-refreshed the browser and cleaned my cache. I tried in Chrome, Firefox, Firefox DE and IE. No luck.

Re: Dynamic Partner Badge Not Working

Top Contributor
# 4
Top Contributor

Hi @Matt K,

 

Have you verified your Google Partner ID? 

 

The code should be placed in the body of your HTML code and look like this:

 

<script src="https://apis.google.com/js/platform.js"></script>
<div class="g-partnersbadge" data-agency-id="XXXXXXXXXX"></div>

Nothing should be altered other than changing out the agency id XXXXXXXXXX for your actual 10-digit id. If your id is wrong, it won't call the API and throw the code you posted. And it could be that the system was doing maintenance or having a temporary technical issue as you were adding the code. And I have seen some partners add the code and it take a few hours for it to pull the badge. 

 

When you add the code to your WordPress site, are you using a theme that allows you to see the page code? 

 

I suggest adding the above code with your correct agency id... then waiting some hours and seeing what happens.

 

If it still doesn't load, you could contact AdWords support or you can post up your website address and I would be happy to look at the page code where you added the partner script and see if there is some broken coding elsewhere on the page, like a missing or open div... which could effect the partner script.   

 

Kind Regards,

 

James

 

_________________________________________________________
Google AdWords Top Contributor | Google Partner | GYBO | Local Guide | My Profile


 


 


 

Dynamic Partner Badge Not Working

Top Contributor
# 5
Top Contributor

WordPress does not play well with code in pages or posts. I usually try to put it in a sidebar or footer widget where you can make it work fairly easily. There are plugins to help you do the job as well. WP Insert Code is one that comes to mind.

Dynamic Partner Badge Not Working

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭

@James_Clemens, @MikeJohnston. I'm sorry, I was a bit ambiguous. I am not putting the code in the WordPress WYSIWYG, rather I am putting the code directly into the PHP files of our custom WordPress theme.

Also, the code works without any problems when placed into a basic HTML page running under WAMP, that's what makes me think it might be a WordPress problem (or at least a problem with how the code interacts with WordPress). I've also been trying to get this working for a week now, so I don't think time is really a factor.

Dynamic Partner Badge Not Working

Top Contributor
# 7
Top Contributor

Hi @Matt K,

 

Thanks for the additional information. 

 

The theme you are using is certainly playing rough with the Google Partner script. Being that it works in your other methods, we know the code works and you are supplying the info correctly. Themes can do really odd things when additional code is introduced. 

 

In your situation, you will need to troubleshoot the theme maker, source files... or use a plugin, like Mike suggested. 

 

Kind Regards,

 

James

_________________________________________________________
Google AdWords Top Contributor | Google Partner | GYBO | Local Guide | My Profile


 


 


 

Dynamic Partner Badge Not Working

Top Contributor
# 8
Top Contributor

Is your theme custom as in developed for you alone or is it a custom design based on a free orbpaid theme/framework? The reason I ask is that, every time WordPress updates you will lose your code if you put it directly into the main theme files. You need to create a child theme and can install or modify main theme code that way as child theme settings are saved through WordPress updates.