Web tracking does not load asynchronously. To reduce the load times for their web page(s), customers may have to load the Campaign web tracking script dynamically and capture web tracking events.
To reduce the load times for their web page(s), customers want to load the Campaign web tracking script dynamically and capture web tracking events.
Use this function
ewt.init()
: To generate Page View and Site Visit Event(s) Or Add web sync id / visitor key to anchor tagsewt.init({generatePageViewEvent:true})
: To generate pageview and site visit events; does NOT add web sync id / visitor key to anchor tagsewt.init({appendVisitoryKeyToLinks:true})
: To append websyncid / visitor key to anchor tags, but not generate pageview eventsewt.init({generatePageViewEvent:true, appendVisitoryKeyToLinks:true})
: Same as ewt.init()
Perform the following steps to dynamically load web tracking script
- Copy and paste the meta tags from the web tracking settings of your organization settings to the head section of the HTML page. Example of meta tags:
<!-- Please insert the following code between your HTML document head tags to maintain a common reference to a unique visitor across one or more external web tracked sites. --><meta name='com.goacoustic.brandeddomains' content='www.pages03.net,www.goacoustic.com' /> <!-- Optionally uncomment the following code between your HTML document head tags if you use Conversion Tracking (COT). --> <!--<meta name='com.goacoustic.cothost' content='campaign-us-3.goacoustic.com' />-->
- Copy and paste the code below into the body of your HTML page.
<script type="text/javascript"> function downloadJSAtOnload1() { var element = document.createElement("script"); element.src = "REFER_TO_YOUR_WEB_TRACKING_SETTINGS_FOR_THE_CORRECT_URL" document.body.appendChild(element); var myVar = setInterval(function() { myTimer() }, 10); function myTimer() { if (typeof ewt != 'undefined') { clearInterval(myVar); ewt.init(); //Please refer to the table above if you would like to add parameters to your ewit.init() call } } } if (window.addEventListener) { window.addEventListener('load', downloadJSAtOnload1, false); } else if (window.attachEvent) { window.attachEvent('onload', downloadJSAtOnload1); } else window.onload = downloadJSAtOnload; </script>
- Start tracking by implementing the events.