Advanced Usage and Options


  5 months ago by Admin

Please see the Conversion Tracking Overview for general information about how Taveo's Conversion Tracking works.



Conversion Tracking script function options

Taveo's default conversion tracking JavaScript does the following two things

  1. Searches the domains tav.so and zo.gd for cookies.
  2. Registers a conversion as soon as the page is loaded.

These 2 default actions are customizable, through the use of the JavaScript function _ttf();. In order to customize the JavaScript, you should add or replace the default _ttf(); function.

Customizing

All customization is done through the use of the _ttf() function, which accepts parameters in the following format:

   _ttf("action","Optional_parameter,"Optional_parameter2")
Default JavaScript

    <script type="text/javascript">
        (function(a,b,c,d,e,f,g){a.TaveoObject=e,a[e]=a[e]||function(){
        (a[e].q=a[e].q||[]).push(arguments)},a[e].l=1*new Date,f=b.createElement(c),
        g=b.getElementsByTagName(c)[0],f.async=1,f.src=d,g.parentNode.insertBefore(f,g)
        })(window,document,"script","https://tav.so/s/taveo.js","_ttf");
        _ttf("create", "T--1");
        _ttf("view"); //Add or edit this to customize conversion Tracking. 
    </script>

Actions

The following actions are supported

Action Name Parameters Description Notes
create

your public account ID (ex., T-12345-1), found here.

This action initializes everything.

This action is required as the first action called and should not be moved or modified!
view

None

This action registers that the current page view was a conversion.

The default conversion method.
attach

2 parameters: event and selector. Event must be a JavaScript event (with the on removed, so "onclick" is just "click") and selector must be a CSS2 selector

This action will register a conversion when the event you specified happens.

This action allows you to register various advanced conversion options, such as someone clicking a button on the page, or moving their mouse to a specific location. See the examples below.
click

None

This action will immediately register a "click" conversion.

This action is meant to be used within your JavaScript code, for example within an onclick event handler you have already written. If you just want to register conversions based on clicking certain elements on the page, use the "attach" action!
submit

None

This action will immediately register a "submit" conversion.

This action is meant to be used within your JavaScript code, when someone submits a form.
domain

The base url you of the domain you are using with Taveo, without the http(s)://

This action will tell Taveo to search your domain for cookies.

This action is required when you are using your domain with Taveo. The base url is the url you see on the domains page, minus the http(s)://. You can use this multiple times if you have multiple domains.

Advanced Example #1

In this example, we will use the attach action to register a conversion whenever anyone clicks a link that has the css class itconverted.


    <script type="text/javascript">
        (function(a,b,c,d,e,f,g){a.TaveoObject=e,a[e]=a[e]||function(){
        (a[e].q=a[e].q||[]).push(arguments)},a[e].l=1*new Date,f=b.createElement(c),
        g=b.getElementsByTagName(c)[0],f.async=1,f.src=d,g.parentNode.insertBefore(f,g)
        })(window,document,"script","https://tav.so/s/taveo.js","_ttf");
        _ttf("create", "T--1");
        _ttf("attach","click",".itconverted"); 
    </script>

Now, whenever anyone clicks on any html element with a class of "itconverted", Taveo will register a conversion. This could be used when multiple "Sign Up" links exist on a page, and you want to track conversions for all of them

Advanced Example #2

In this example, we will register our custom domain and register a conversion whenever any clicks an html element with the id of "feedback". To get the base url for the domain action, we looked at the domains page and found http://mywebsite.net/x.


    <script type="text/javascript">
        (function(a,b,c,d,e,f,g){a.TaveoObject=e,a[e]=a[e]||function(){
        (a[e].q=a[e].q||[]).push(arguments)},a[e].l=1*new Date,f=b.createElement(c),
        g=b.getElementsByTagName(c)[0],f.async=1,f.src=d,g.parentNode.insertBefore(f,g)
        })(window,document,"script","https://tav.so/s/taveo.js","_ttf");
        _ttf("create", "T--1");
        _ttf("domain","mywebsite.net/x");
        _ttf("attach","click","#feedback"); 
    </script>

Advanced Example #3

In this example, we already have some custom JavaScript that does something when a user converts, so we will use the click action within our custom JavaScript.


    <script type="text/javascript">
        (function(a,b,c,d,e,f,g){a.TaveoObject=e,a[e]=a[e]||function(){
        (a[e].q=a[e].q||[]).push(arguments)},a[e].l=1*new Date,f=b.createElement(c),
        g=b.getElementsByTagName(c)[0],f.async=1,f.src=d,g.parentNode.insertBefore(f,g)
        })(window,document,"script","https://tav.so/s/taveo.js","_ttf");
        _ttf("create", "T--1");
    </script>



<table id="outside"> 
    <tr><td id="t1">You Haven't Signed up Yet!</td></tr> 
    <tr><td id="t2">Please Sign up Today!</td></tr> 
</table>



<script type="text/javascript">
    function modifyText() {
        var t1 = document.getElementById("t1");
        if (t1.firstChild.nodeValue == "You Haven't Signed up Yet") {
            //only change and register conversion once
            t1.firstChild.nodeValue = "Thanks for Signing up !";
            _ttf("click", this);
        } 
    }

    // add event listener to table
    var el = document.getElementById("outside");
    el.addEventListener("click", modifyText, false);       
</script>













Can't find the answer to your question? Contact our support team