The translation was generated automatically and may contain mistakes
Write to us
With the help of the “Write to us” widget, you can add a quick and convenient way to communicate via VKontakte messages to your site in 5 minutes.. Clicking on the widget, users will go to the dialogue and will have the opportunity to ask a question, clarify the price or consult about services.
Using a widget or a short vk.me/ address (a short user or group address), you can always share your contacts quickly.
Adjust the widget text to match the user’s needs as closely as possible.
Widget connection
To add a “Write to Us” widget to your site, follow these steps:
Step 1. In the tag <head> On your website, add a link. openapi.js :
<script src="https://vk.com/js/api/openapi.js?169" type="text/javascript"></script>Step 2. Add an element to the body of the page <div> , which will display comments, give it a unique id, and add a widget initialization code to it. For example:
<div id="vk_contact_us"></div>
<script type="text/javascript">
VK.Widgets.ContactUs("vk_contact_us", {}, -20003922);
</script>This code adds a button to communicate with the group administration Widgets are VKontakte .
If your website is already in use Open API , adding a widget is even easier. Simply add widget initialization.
Additional settings
Method VK.Widgets.ContactUs It takes parameters:
- •
element_id(string), the mandatory parameter is the id of the element that will be the button container for communication. Our default constructor uses a valuevk_contact_us. - •
options(object) — block options with widget. An object that can contain fields:- •
text(stringtext on the button, maximum140symbols. The default is “Write to us.” - •
height(integerThe height of the button in pixels. Possible values:18,20,22,24,30. By default:24.
- •
- •
owner_id(integer), a mandatory parameter is the user or community ID for which the widget will be created. The community ID must be indicated with a sign-(minus).
Websites without JavaScript support
If you can’t run JavaScript scripts on your site, for example, your blog platform doesn’t support this functionality, you can post a direct link to link to the VKontakte group.. The reference is as follows:
The code to place it might look like this:
<a href="https://vk.me/club20003922" target="_blank">Задать вопрос</a>Example of use
<div id="vk_contact_us"></div>
<script type="text/javascript">
VK.Widgets.ContactUs("vk_contact_us", {text: "Задайте свой вопрос"}, -20003922);
</script>Код виджета
To add a widget to your site, simply copy the code to paste to the page you want to place the widget on.