Add a rule for the purchase event in Experience Platform tags

This video shows how to use the product string extension in Experience Platform Launch to track purchases on your site, resulting in the Revenue, Orders, and Units metrics in your analysis.

NOTE
Launch is now tags
Transcript
Hey everybody, this is Doug. In this video, I want to talk to you about adding a launch rule for the purchase event if you are a retail site. So like the other video about basic retail variables, you only need this video if you are a retail site, and if you’re not a retail site, you can move on. If you are a retail site, you’re going to want to watch this. So in this video, again, we’re going to talk about creating a rule for the purchase event and as mentioned, we already did a video about the other basic retail variables, in other words, doing a product view, a cart add, a checkout, or any of the other steps that you want to do there, and I might add that if you wanted to add things for like, shipping or billing or other steps in your checkout process but we don’t really have a pre-named variable like scCheckout or scAdd, then you can always use custom events, like I could use event5 for entered shipping information or something like that. So you can use any number of custom events for additional steps, but we do have kind of these pre-named ones there for your using for commonly tracked steps, okay. So in this case again, purchase is what we’re after. So if we go back over to launch, you’ll see here that I’m in the Data Elements section, so I’ve opened my property, I’m in Data Elements because I did just have to create a couple of extra data elements, and the ones that I created, especially to use for the purchase event, are the Product Total Revenue and the Product Total Units. And so these are going to be pulled from the data layer, and you’ll see here that I have productTotalRevenue right here and productTotalUnits, but again, as always, if you don’t have a data layer with these items in it, then you can pull that information from wherever you have it on your site. I’m assuming that if you have a retail site then you know how many items they bought and you know the revenue for those items. In this case again, it is the total revenue for these items, so if it’s 2,600 here, if I were buying two tuxes, 'cause you never know when you’re going to need an extra one, then of course, you would just multiply this by two. So you’d have 5,200 and that would be the revenue you’re putting in instead of 2,600. So you don’t put the individual price, you put the total price for the number of items of that product that you bought.
So that was step one to make sure that you have that in a data element. Now let’s go to our rules and create the rule for this. So you can see we have our other steps in here, I’ve got my prod view at DOM Ready 50, we’ve got our add to cart and our checkout all happening at DOM Ready 50, so that they all get set, these variables, before the default page load rule runs at number 60. So just in order after these items, and it sends in the beacon, okay. So let’s add another rule.
We’ll call it Purchase- DOM Ready 50. The event is, again, we just said it, DOM Ready 50, is the order, save that. So that’s when it happens on the page, again, at the bottom of the page, but it only happens when it’s a purchase, so we need to look again at our source and see that the product event says purchase. I’m going to copy that.
So we go into our condition type, use a value comparison, very common for us to use that if we’re pulling data out of a data layer into a data element, so we can now see if our data element, product event, equals purchase, paste it in. This will only run then on that order confirmation page where that value is there, okay, keep the changes. Now what do we do again when that all happens? We do our actions and we’re going to set the product variable by using this product string extension, just like the other ones, Setting s.products, this time we’re going to say it’s for a purchase, and you might remember in other rules, if we said that it was for, say, a prod view, it only asks us for the product. And so we say it’s a purchase because it knows that it needs more information this time. So now we can go say the product ID or name is going to be pulled from the Product ID data element.
The variable for product quantity Product Total Units.
And total product price, Product Total Revenue right there.
And now it knows how to build s.product, so we’ll keep that.
Now of course one more thing, we need to add another action which is the analytics extension, and Set Variables, and set the purchase event. So events, purchase, where are you, there you are, purchase, and that’s it.
Keep.
And now we are setting the product string, we’re setting the purchase event, we’re only doing it when it’s the purchase confirmation page, and we’re good to go because it’s happening on DOM Ready 50 before the beacon gets sent in.
Save it.
It builds a library, says we’re good, now we can go back to our site and we can actually run through this, so let’s go back and start over, we’ll go to the tuxes, and we’re going to see how many we have in our cart here, we have two of them so let’s empty that and start over. So we’ll go back to our tuxes again, let’s open up the debugger, and clear it, put this over here, okay, now where I’m on this page we see that we have a prod view, we add it to cart, we get our cart add, we checkout we get our checkout, jump over and see our checkout with scCheckout in the event1 for the page view, and then we go through the shipping, the billing, and those are just regular pages with only just the page event. Then when we purchase that and we’re on our purchase confirmation page, now we should have all the extra stuff. So we have our events, so we have our purchase event, event1 for the page view, that’s great, and now we have our item purchased which is 201233 semicolon 1 item and semicolon and $2,600, so we have our product string now that we need for our purchase event, and that can go in and fill all the right reports and now we are good to go for our purchase event.
recommendation-more-help
b5d9c99f-be9f-4b96-8809-4e7d6ae353ba