Only for client side implementation!This base tag should only be included when using the client side (javascript) implementation of the Tweakwise Event Tag.
This base tag should be included on every page of your website. It will generate a custom profile key in the background and store it in a cookie. This profile key is used in various requests
<script>
(function(w, d, l, i, u) {
w['_twa'] = l;
w[l] = w[l] || [];
w[l].push({ 'twa.start': new Date().getTime(), event: 'twa.js' });
w[l].push({ 'twa.instance': i, event: 'twa.init' });
var f = d.getElementsByTagName('script')[0],
j = d.createElement('script');
j.async = true;
j.src = u;
f.parentNode.insertBefore(j, f);
})(window, document, 'tweakwiseLayer', '{INSTANCEKEY}', "//navigator-analytics.tweakwise.com/bundles/scout.js");
</script>Replace {INSTANCEKEY} with your Tweakwise instance key.
Using custom profile key
In some cases, you might want to determine the profile key yourself. For example, if you want to support cross-device personalization, it is recommended to use the currently authenticated user. Use this extended version of the base tag to pass your own custom profile key to the tag.
<script>
var profileKey = '{PROFILEKEY}';
(function(w, d, l, i, p, u) {
w['_twa'] = l;
w[l] = w[l] || [];
w[l].push({ 'twa.start': new Date().getTime(), event: 'twa.js' });
w[l].push({ 'twa.instance': i, event: 'twa.init' });
p && w[l].push({ 'twa.profile': p, event: 'twa.profile' });
if(p){ w[l].getProfileKey = function(){ return p; } }
var f = d.getElementsByTagName('script')[0],
j = d.createElement('script');
j.async = true;
j.src = u;
f.parentNode.insertBefore(j, f);
})(window, document, 'tweakwiseLayer', '{instancekey}', profileKey, "//navigator-analytics.tweakwise.com/bundles/scout.js");
</script>Replace {INSTANCEKEY} with your Tweakwise instance key.
Replace {PROFILEKEY} with your custom profile key.
