Functions
Get the most out of your experience with Vantevo Analytics.
Discover some features you might use to gather more information from your website.
Contact Form 7 - Wordpress Plugin
A simple example of how you could link the Vantevo script with Contact Form 7, the most popular contact form plugin is more used than Wordpress.
<script>
document.addEventListener('wpcf7mailsent', function( event ) {
if (event.detail.contactFormId == '1123') {
vantevo('ContactForm', {})
}
}, false );
</script>
How to exclude a specific link from the monitoring of outbound links
data-vantevo-exclude-outbound-link
In this case when a visitor clicks on this link the Vantevo script will not save the Outbound Link
event. The data-vantevo-exclude-outbound-link
tag can be used together with the download tracking tag of outgoing files data-vantevo-exclude-track-file
.
<a href="https://example.com" data-vantevo-exclude-outbound-link>Link</a>
How to exclude a specific link from file download monitoring
data-vantevo-exclude-track-file
In this case when a visitor clicks on this link the Vantevo script will not save the event File Download
. The tag data-vantevo-exclude-track-file
can be used together with the tracking of outbound links tag data-vantevo-exclude-outbound-link
.
<a href="https://example.com/pdf.pdf" data-vantevo-exclude-track-file>File</a>
Javascript - form button submit events
<form>
....
<button
type="submit"
data-vantevo-form="Contact"
data-vantevo-meta='{"recipes":"italian burger"}'
>
Send
</button>
</form>
<script>
let buttons = document.querySelectorAll("button[data-vantevo-form]");
for (var i = 0; i < buttons.length; i++) {
buttons[i].addEventListener('click', handleSubmitForm);
}
function handleSubmitForm(event) {
event.preventDefault();
let evn = event.target;
let attrEventName = evn.getAttribute("data-vantevo-form");
let eventName = attrEventName;
let meta = {};
let attrMeta = evn.getAttribute("data-vantevo-meta");
if (attrMeta) {
meta = JSON.parse(attrMeta)
}
vantevo(eventName, meta);
setTimeout(function() {
event.target.form.submit();
}, 150);
}
</script>
How to install the vantevo script in mobile applications
This method works for all hybrid applications, for example: Cordova
, Ionic
, Framework7
, Capacitor
etc. For native applications you can use our API.
Add a new domain in your dashboard on Vantevo Analytics.
Make sure the script contains the
data-param-domain
parameter and has the domain added before in your dashboard as value, almost all hybrid applications use thewebview
in localhost, for this you need to use thedata-param-domain
.Authorize your application hostname to collect statistics, see how authorize a domain
Check if in your application you can change the hostname of the app, by default your application hostname could be
app://localhost
orionic://localhost
. To change the hostname of your application you may need to add the following code in theconfig.xml
file:<preference name="hostname" value="app.example.com" />
, find out more about https://github.com/ionic-team/cordova-plugin-ionic-webview#configuration. If your application does not allow you to change the hostname, no problem you can use the default hostname. If the hostname also has a port, exampleapp://localhost: 8080
you need to use the full hostname while also adding the port to authorize your application's hostname.
If your framework uses hashes check if you also need to use the data-param-hash
parameter to collect the statistics.
<script defer id="vantevo-analytics" data-param-domain="app.example.com" src="https://vantevo.io/js/vantevo.js"></script>