adding google code to site

General questions relating to Joomla! 3.x. Please consider the availability of third-party templates and extensions when deciding which Joomla version to use.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
designsforyou
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Sun Jan 21, 2018 1:56 pm

adding google code to site

Postby designsforyou » Sun Jan 21, 2018 2:02 pm

good afternoon, quite new to joomla, but learning fast

im trying to add the code from google onto a site to display the google badge for google seller stars rating system.

im using jommla 3.8.1

the code to add is below from google merchant account

<script src="https://apis.google.com/js/platform.js?onload=renderBadge" async defer></script>

<script>
window.renderBadge = function() {
var ratingBadgeContainer = document.createElement("div");
document.body.appendChild(ratingBadgeContainer);
window.gapi.load('ratingbadge', function() {
window.gapi.ratingbadge.render(ratingBadgeContainer, {"merchant_id":});
});
}
</script>

Badge Integration

Optional: Use the badge to display your participation in the Google Customer Reviews program as well as show your seller rating on your site.

To get started, add the code snippet below to any page on your site and customize the variables as needed. After the code snippet has been added, verify the badge and attached text appear as expected on your site. Note: If there aren’t any seller ratings available, the message "no rating available" will appear. Learn more

i can change the variables to the merchant id i need.

problem is when i add the code to the site it shows the actually code on the screen of the website instead of the google badge.

any help would be great thanks

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 23912
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

Re: adding google code to site

Postby Per Yngve Berg » Sun Jan 21, 2018 2:57 pm

Did you enter the code in the index.php file of your template?

Or use an extension: https://extensions.joomla.org/category/ads-a-affiliates/affiliate-systems/

designsforyou
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Sun Jan 21, 2018 1:56 pm

Re: adding google code to site

Postby designsforyou » Sun Jan 21, 2018 3:59 pm

hi thanks for helping.

no im in the backend of the site, in the modules, (This module allows you to create your own Module using a WYSIWYG editor.)
when you can write text, and there is a tab for editor, code and preview.

designsforyou
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Sun Jan 21, 2018 1:56 pm

Re: adding google code to site

Postby designsforyou » Mon Jan 22, 2018 8:13 pm

hi what do you all think?>

User avatar
fcoulter
Joomla! Ace
Joomla! Ace
Posts: 1445
Joined: Thu Sep 13, 2007 11:39 am
Location: UK
Contact:

Re: adding google code to site

Postby fcoulter » Tue Jan 23, 2018 5:35 pm

I think that you mean that you are using the Joomla custom html module. From the sound of it, when you add the code the editor is encoding the html tags so that you see the code rather than it being interpreted as html.

The easiest thing is probably to edit your user account to turn off the editor temporarily. In the Joomla user manager, find your user account name and click on it to edit your profile, on Basic Settings tab set editor to 'none'.

Then go back to your module and you should see a simple text box, paste the code in that and save.

Once you have saved and closed the module you can go back to your user account and turn the editor on again.

If you find that the <script> tags are being stripped out you may need to edit the global configuration for your user group so that the text filters are set to "no filtering".
http://www.spiralscripts.co.uk for Joomla! extensions
http://www.fionacoulter.com/blog my personal website
Security Forum moderator
VEL team member
"Wearing my tin foil hat with pride"

designsforyou
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Sun Jan 21, 2018 1:56 pm

Re: adding google code to site

Postby designsforyou » Tue Jan 23, 2018 8:29 pm

hi @fcoulter

tried all your steps, and yes its stripping out the <script> tags

i cant find the way to edit the global configuration for user groups, so the text filters are set to ' no filtering'
any ideas?

User avatar
sozzled
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4214
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: adding google code to site

Postby sozzled » Tue Jan 23, 2018 8:45 pm

If your WYSIWYG editor is stripping out the <script> tags then, as @fcoulter suggested, [temporarily] change your editor in your account. Do you know how to change the editor in your account? Change the editor for your [administrator] account to "No editor" or "Codemirror", then edit the module and try to add the script.
https://www.kuneze.com/blog
Former member of Kunena project team
If you think I’m wrong then say “I think you're wrong.” If you say “You’re wrong!”, how do you know?

User avatar
fcoulter
Joomla! Ace
Joomla! Ace
Posts: 1445
Joined: Thu Sep 13, 2007 11:39 am
Location: UK
Contact:

Re: adding google code to site

Postby fcoulter » Tue Jan 23, 2018 8:48 pm

go to system->global configuration, select the text filters tab, select the user group that your account belongs to, presumably, super users, make sure it is set to 'no filtering'.

Then do as I said, set the editor as 'none' for your user account. Paste the code, save and close the module.That is all that you need to do.

If you re-enable the editor again and then open the module again then yes it will strip the script tags out again, so don't open the module while the editor is enabled for your account.
http://www.spiralscripts.co.uk for Joomla! extensions
http://www.fionacoulter.com/blog my personal website
Security Forum moderator
VEL team member
"Wearing my tin foil hat with pride"

designsforyou
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Sun Jan 21, 2018 1:56 pm

Re: adding google code to site

Postby designsforyou » Wed Jan 24, 2018 7:57 pm

thank you this work, thanks for all your help.


Return to “General Questions/New to Joomla! 3.x”

Who is online

Users browsing this forum: No registered users and 17 guests