Hey guys! I got some new computer glasses so you don't see me all nerdy and everybody looks orange for me so it's a lot easier on my eyes. today I'm going to talk about Google tag manager and how to use a lookup table to basically translate the value that you want. So in this case scenario after someone buys a product the URL you get a URL parameter. You get the question mark and then you get a bunch of values after that and for whatever reason this is on a teachable platform.
They don't provide a decimal within the value so it looks like as you can see the the URL the full URL string goes over here I always like to have a kind of working back at the side so it's easier to see as the string is pretty long you get the final price. And actually yeah that's what we watch the final price so this is the final price it's it should be 279 20.
So we always want it to be two decimal points from the left naturally so that's really how we want it to look inside of Google Analytics for the the products for e-commerce value for the goal value and right now it just shows 279 20. I mean we could do that in our head always, but especially if you're working with a large e-commerce store and you want to use variables you have to do it in a smart way and so today I'm going to show you how to use a lookup table hidden, Google tag manager to sort of translate one variable the values of that to the values that don't you want to see.
So let's go ahead and dive into it. We already have the URL variables set up which are right here we have the final price variable so it's looking for a query and it's returning the final price which you always see so the query starts right here the question mark and then you just have all these different query keys they're called.
So coupon is a key and then you'll see the equals so it's always what comes before the equals right and so you let's see the next one which is the see the sidebar show that Cephei sought from the sidebar or something like that you see the currency. So you could put any of these and we wanted the final underscore price so the and the ampers and separate those so final price is what we literally just copied and pasted.
if you have to make sure you do it exactly so, I always just copy and paste and put that in for the query key and now it returns that always if that is a part of the URL parameters and so I like to look it's one of these things, I like to do is look for useful query strings, I also look for useful cookies and according based off of that you set those accordingly. You know, kind of an overview query strings are session based naturally right you can't face you know from one page to the other whereas cookies that can be a little more valuable based on the context. While you're using it because that's use you based and you'll always have that cookie unless you set it to expire at a certain time question so something to think about but the point the point here is to use the query parameter value here and to use that with a lookup table.
So the first step is making sure you have the URL parameters being set and that is what we wanted to do here. So I just said that with URL and then after that you choose what type you want many different types as well here and then it shows that I think you can actually format it. If it'is, you could change the case convert nulls something else but this isn't going to help us in this scenario we did a little bit more more options that's what we're using a lookup table so that's what we're going to be using in the lookup table.
So this is other variables and GTM it's a new user defined variable, sorry my voice is a little bit I have a cold that's a little bit nasally here I can hear myself. Look out tables just retype some look-up tables other utilities there's a lookup table as a regex table. We don't need reg X in this case but I like to point this out because I've used it before that keeps valuable in some circumstances you go to a regular. Express this, I would Google that and to get a feel for that if you know what it is you know how it could be useful in some circumstances but I'm gonna use a lookup table.
Don't know what happened there okay so I like to name this always what the you know basically what I'm doing whether it's a tag trigger variable. So lookup table space dot space and then this is going to be for the or if I copy that nots final price is the actual lookup table we're doing and that's probably all I would I would put there may be adding translate try a better word. That's basically what we're doing and actually I have a navy Commission system. so that's how we do it, company name first since this is a client to come. Okay, so what we watch here is what we just looked at the URL final price variable which is URL final price. That is the input variable of what it's based off of. What the key is going to look for. So now all we have to do is add a row and we know that if the input is 29 X 20. We want it to actually be this and we're actually going to test this real time to TVB.
The trust but verify and we aren't going to go ahead and refresh and we're gonna check this page and we're going to see this variable at work. So we're gonna go ahead and look for LT your lookup table yeah that's that's I don't think I need to – there we go oh yeah the ECU is first alright? So look up the table the string as you could see it came back with the correct value now we can actually see what the price is and this has the benefit of in Google Analytics. We can actually see this house was really ended up basically so.
I'll go ahead and show you that really quick -so let's go back to G TM and let's change out in our Google Analytics sites. We have instead of now the before, we have a final price as the variable coming in we are the the LT the lookup table variable so we're gonna go ahead and save this and now we will see that come into a lot of legs I don't think this is in.
Yeah, this is gonna be a custom dimension, so it would I'd have to create an event for this to see this in real time so I'm gonna go ahead and leave that for another video but this will show up in Google Analytics probably like an hour after I do it. Opted with that being set now as a custom dimension so hope that helps you. Thanks
Ready to Finally Know Your Business Numbers?
Start the conversation now, Ryan only takes on select and limited clients.