Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to track multiple tracker id from one snippet #21

Open
michalsikora opened this issue Aug 16, 2016 · 0 comments
Open

Add support to track multiple tracker id from one snippet #21

michalsikora opened this issue Aug 16, 2016 · 0 comments

Comments

@michalsikora
Copy link
Collaborator

Currently we have snippet with hardcoded tracker id

<script type="text/javascript">
    (function (w, d, t, g, u) {
        w[g]=w[g]||function(){(w[g].q=w[g].q||[]).push(arguments);};
        var tag=d.createElement('script');
        tag.async=true;tag.src=u+'?g='+g+'&t='+t;
        var s=d.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(tag, s);
    }(window, document, 'WEBA-0001', 'weba', '//example.com/path.to.tracker.js'));
</script>

And the thing is to remove tracker id from snippet eg: 'WEBA-0001' and move logic outside.
Below one of possibilities to implement:

weba('create', {
    name: 'firstTracker',
    trackerId: 'WEBA-01'
});
weba('firstTracker.send', {
    event: 'pageView'
});

weba('create', {
    name: 'secondTracker',
    trackerId: 'WEBA-02'
});
weba('secondTracker.send', {
    event: 'pageView'
});

For one tracker it should work like this:

weba('create', {
    name: 'onlyOneTracker',
    trackerId: 'WEBA-01'
});
weba('send', {
    event: 'pageView'
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant