- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
10-20-2014 06:02 AM
Solved! Go to Solution.
10-20-2014 07:06 AM - last edited on 10-05-2015 12:20 PM by kathleen_jo
This is easy to do in Tealium. You just need to create 2 instances of the Google Analytics tag.
Apart from the account id, where you enter your UA-1234-1 account number, there are two other important settings. First, make sure that in the "script source" setting, you choose Google (external). This prevents you loading the whole library twice.
Secondly, give each of the trackers a distinct name. For example if you have an account for the site and a roll-up account to collect data from multiple sites, you could call them "global" and "local".
The two trackers will now collect the same page view data.
If you want to collect different event data, there are two ways that you can achieve this, but they both involve using a custom JavaScript code extension. One method is to create an extension scoped to the tag instance which checks for relevant events and returns false if it's not going to record the data. You can insert your own condition here:
// a is event type, "link" is an event
// b is the data object
if (a === "link" && b.local_event === false) {
return false; // do not collect this event
}
The other alternative is to create the events explicitly in GA style:
jQuery("button#add-to-basket").on("click", function () {
ga("local.send", "event", "add-to-cart", "clicked");
});
In the second example, the prefix before the send is the name of the tracker.
10-20-2014 07:07 AM - last edited on 10-05-2015 12:20 PM by kathleen_jo
Hi Alicia,
Thanks for reaching out. Sure - this is easy. You need to use a different tracker name for each account which you can configure in the tag (or map it if you like):
http://note.io/1rn9oYC
You can give them any name you want (within reason! e.g. 'a' and 'b' perhaps) and they'll fire data to each tracker differently.
If you then wanted an event to fire for one GA tag but not another then you could write a 'javascript' extension which would stop the tag from firing based on conditions.
For example, let's say that you set the following 'event_action', 'event_category' and 'event_label' data sources which are mapped to both tags:
event_action = 'facebook like'
event_category = 'social'
event_label = 'facebook'
Let's now say that we only want this event to fire in tag A and not tag B - we can create the following javascript extension which will stop tag B from firing when this event gets triggered:
extension : http://note.io/ZCGc9A
code : http://jsfiddle.net/tuy0eme4/
When a user performs the action you want tracking in GA A only (not GA B), although both tags will be called this code will kill the call in tag B when Tealium hits it (you must scope this extension to tag B for this to work).
I hope this makes sense. Feel free to reach out to your local account manager if you need a hand with this.
10-20-2014 09:11 AM
Copyright All Rights Reserved © 2008-2023