Profile views registration is required when you use API 2GIS. You can do it by including a JS tracker.
DG.apitracker. It becomes available after the following code has been loaded:
Please don’t forget that this file should be included in each page that uses 2GIS API.
The registration of the profile views is carried out by calling the
DG.apitracker.regBC( [reg_bc_url] ) method, where
[reg_bc_url] is a set of additional data for an event registration, collected in a company branch profile in the
reg_bc_url field. The ways to call the
An example of calling an event registration when loading the page:
In addition to the profile views registration it is recommended to register additional events. To register the events you need to visually hide a part of the data and display it on user request. For example, to display only a part of a phone number and replace the hidden part with the “Show phone” button. When a user clicks this button an event is registered. The registration is carried out by calling the
DG.apitracker.regBCEvent( [reg_bc_url], [event_type] ) method, where
[reg_bc_url] is the same data that was used when registering profile views and
[event_type] is an event that was made by the user. It can be one from the following list:
show_address— company addresses; the event is registered when the company addresses block is displayed;
show_contact_email— the event is registered when a contact with the email type is displayed;
show_contact_phone— a phone number; event is registered when a contact with the phone type is displayed;
show_contact_skype— the event is registered when a contact with the skype type is displayed;
show_contact_social_profile— a social network contact; the event is registered when a contact with vkontakte, twitter, instagram, facebook, odnoklassniki, googleplus, linkedin, youtube, or pinterest types is displayed.
An example of calling an event registration when clicking the “Show phone number” button: