Skip to main content

JS functions. Filtering events for transmission

Written by Valeriia Zaptalova

In the Ringostat Panel, you may configure call transmission through Custom JavaScript Functions for different substitution types: Callback or calls from dynamic number substitution.

Calls from static number pools that do not originate from the website cannot be transmitted in this way.

To configure this, please add a JS function in the section Call trackingCustom JavaScript Functions.


Example configuration — transmitting the Call via Callback event

To do this, please click Edit code and add the following code along with the event name — for example, RingostatCallback:

(function(data) {
if (Insertion_type=='callback')
{
dataLayer.push({'event': 'RingostatCallback'})
}
});

You may choose the event name freely — the most important part is linking it to further settings in GTM.

In the GTM interface, please create — as described above — a trigger of the Custom Event type, with the name corresponding to the defined event:

Next, please go to the Tags section and create a new tag, setting:

  • Tag type – Google Analytics / Universal Analytics

  • Tracking type – Event

  • Category – event name (the same as in the trigger)

  • Action – action

  • Label – event label

  • Value – event value (e.g., 10)

  • Google Analytics settings – GA identifier or a variable containing the identifier

  • Activation trigger – the trigger created earlier

After completing these steps, please save and publish the changes.

After a Callback-type call appears on the website, an event with the name you specified will appear in the Google Analytics reports.


Available additional filters

Below are the parameters that can be used to create filters:

Parameter

What it contains

Example value

Insertion_type

Number replacement type

callback, dynamic, static

Type

Call type

in(incoming),out(outgoing),callback

Call_count

What is the charge for the call from this customer?

1, 2, 2003

Unique_call

Is this the first call from this number?

true / false

Source

utm_source of the visitor

google, facebook

Medium

utm_medium

cpc, organic

Campaign

utm_campaign

brand_search_2024

Keyword

utm_term (keyword)

buy air conditioner

Content

utm_content

banner_top

Pool_name

Number pool name (usually = source/channel)

google_cpc

Last_Page

The page from which the call was made

/contacts

Referrer

Where did the visitor come from?

Visitor_UUID

Google Analytics Client ID

12345678.87654321

Visitor_IP

Visitor IP address

93.12.34.56

ID_call

Unique Call ID in Ringostat

9876543

The_number_in_the_E.164_format

Customer phone number

380991234567

Responsible_managers

Manager IDs in the distribution

[101, 205]

Call_forwarding_scheme

Redirection scheme name

Sales department

Google_Analytics_resource_ID

GA Resource ID

UA-12345678-1

Project_ID

Project ID in Ringostat

4567

Additional_number

Employee extension number

101

Custom

Any parameter captured on the site

arbitrary value

Roistat_Visit_ID

Roistat visit ID (if there is integration)

villains_visit_12345

User_agent

Browser and device

Mozilla/5.0...

To add a variable, please begin typing its name or press Ctrl + Space and select the variable from the list.

Filter examples

1. Callback calls only:

(function(data) {
if (Insertion_type == 'callback') {
dataLayer.push({'event': 'RingostatCallback'});
}
});

2. Only first calls from a new client:

javascript
(function(data) {
if (Unique_call == true) {
dataLayer.push({'event': 'RingostatUniqueCall'});
}
});

3. Only incoming calls from Google:

(function(data) {
if (Type == 'in' && Source == 'google') {
dataLayer.push({'event': 'RingostatGoogleInbound'});
}
});

4. Send additional data along with the event(to then use in GTM):

(function(data) {
if (Insertion_type == 'callback') {
dataLayer.push({
'event': 'RingostatCallback',
'call_source': Source,
'call_medium': Medium,
'call_campaign': Campaign,
'call_page': Last_Page
});
}
});

After that, these fields are available in GTM as Data Layer variables, and they can be passed, for example, to GA as event parameters.

Important:

Variables are written with a capital letter. — Insertion_type, Source, Typeetc. If you writeinsertion_type(small) - will not work.

Static numbers are not transferred.— if the number is not from dynamic substitution and not Callback, the function is not called.

Forgot to post to GTM— changes in GTM after saving the tag/trig

Did this answer your question?