Using JavaScript Functions
Note: In the latest tracking system, you can reliably use the JavaScript functions only after your web page has been fully loaded. For example, you can use window.onload
isPersonAnonymous
Syntax:
VineTrack.isPersonAnonymous()
Description: Checks if person is identified or anonymous.
Example:
The following web page displays the "anonymous" div if the visiting person is not known and shows the "identified" div if the person is found in the database.
Anonymous/Identified DIVs
<html>
<head>
<meta charset="utf-8"/>
<!-- This has to be added to all web site pages to make Vine tracking work: -->
<scripttype="text/javascript"src="http://petrdocker.intra/track/t.js?sg=0"></script>
<scripttype="text/javascript">
functionUserBasedShow() {
var anondiv = document.getElementById("anonymous");
var userdiv = document.getElementById("identified");
if (VineTrack.isPersonAnonymous()) {
anondiv.style.display = "block";
userdiv.style.display = "none";
} else {
anondiv.style.display = "none";
userdiv.style.display = "block";
}
}
</script>
</head>
<body onload="UserBasedShow()">
<div id="anonymous"style="display:none">
<p>User Anonymous</p>
</div>
<div id="identified"style="display:none">
<p>User Identified</p>
</div>
<!-- This script has to be added in the place where you want the form to appear: -->
<scriptsrc="http://petrdocker.intra/track/form.js?sg=0&key=1300344016"></script>
</body>
</html>
<html>
<head>
<meta charset="utf-8"/>
<!-- This has to be added to all web site pages to make Vine tracking work: -->
<script type="text/javascript" src="http://petrdocker.intra/track/t.js?sg=0"></script>
<script type="text/javascript">
function UserBasedShow() {
var anondiv = document.getElementById("anonymous");
var userdiv = document.getElementById("identified");
if (VineTrack.isPersonAnonymous()) {
anondiv.style.display = "block";
userdiv.style.display = "none";
} else {
anondiv.style.display = "none";
userdiv.style.display = "block";
}
}
</script>
</head>
<body onload="UserBasedShow()">
<div id="anonymous" style="display:none">
<p>User Anonymous</p>
</div>
<div id="identified" style="display:none">
<p>User Identified</p>
</div>
<!-- This script has to be added in the place where you want the form to appear: -->
<script src="http://petrdocker.intra/track/form.js?sg=0&key=1300344016"></script>
</body>
</html>
doPersonBelongToCollection
Syntax:
VineTrack.doPersonBelongToCollection(collectionID, callbackTrue, callbackFalse)
Description: Checks if person belongs to collection ( an email list or a tag collection in MA).
You can find the collectionID at the end of the MA URL when opening an email list or a tag :

- collectionId : id of collection. You can find collection ID using the table view in Vine for Windows.
- callbackTrue: callback function which is called if person belongs to collection
- callbackFalse: callback function which is called if person does not belong to collection
Example:
<button onclick="VineTrack.doPersonBelongToCollection(1300350354, function() { console.log('Person is in collection'); }, function() { console.log('Person is not in collection'); } )">Test</button>
hasPersonVisitedPage
Syntax:
VineTrack.hasPersonVisitedPage(url, duration, callbackTrue, callbackFalse)
Description: Checks if person has ever visited some page.
- url : Full web address of a web page
- duration: should be set to zero
- callbackTrue: callback function which is called if person visited the given page
- callbackFalse: callback function which is called if person never visited the page
Example:
<script>
window.onload = function (evt) {
VineTrack.hasPersonVisitedPage('https://devmyvine.intra/fi/test.htm', 0, function () {console.log("yes");}, function () {console.log("no");});
}
</script>
identifyPerson
Syntax:
VineTrack.identifyPerson(firstName, lastName, email, phone2, title, country, emailOrPhone, collectionId, callbackSuccess, callbackError)
Description: Creates a new tracked person or adds tracking to an already existing person. Calls function callbackSuccess if there is no error.
One of these parameters must be provided: email, phone2, emailOrPhone. The function verifies if the passed person already exists in the database using first email and then mobile phone number (if provided).
Other parameters optional:
- collectionId : skip this or ask Vine support about the value to pass if you want to use this parameter . (id of collection to add person to in the following format "<collection.id>|<collection.createdate>", createdate must be in ISO format, etc.)
- callbackSuccess: call back function called if identifyPerson returns without errors
- callbackError: call back function called in case of an error
Example:
<script>
window.onload = function (evt) {
VineTrack.identifyPerson("John","Jstest","john@acme.test", "89219567122","sales manager","Austria",null,null, function() { console.log('success'); }, function() { console.log('error'); });
}
</script>
Comments
0 comments
Please sign in to leave a comment.