How to Track Affiliate SalesThis is how to track affiliate sales
Keep track of affiliate sales with Google Tag Manager and Google Analytics.
On one of my earlier blogs post I was sharing an ideas on how to track affiliate links with Google Tag Manager. However, this guidebook is useful if YOU as an affiliate want to advertise someone else's items and simply track all your outgoing affiliate links. What if you are the partner ownership and want to determine which partner has the highest revenue from your project?
This manual shows how to track affiliate sales with Google Tag Manager and Google Analytics. Every time someone arrives on a page with this address and makes a buy, the affiliate gets a commission.
Usually, when the advertised user of a affiliate arrives, a unique affiliate ID is saved in the visitor's web browser. Owing to him a sales can be assigned to the right affiliate. We have three major ways in which this kind of monitoring can be implemented: If the target page has an affiliate_id argument in its target page address, the cookies (with this affiliate ID) are saved in the web server.
Once a user makes a sale and has an affiliate cookie, the value of the cookies is retrieved and saved in the data base. Check at the end of a monthly (or quarterly) period and calculate (or your developer) how much each affiliate has made. GTM with Google Analytics is used for monitoring.
An affiliate_id contains a GTM cookieset (which contains this affiliate ID) and the user-defined dimensions (session scope) are transferred to Google Analytics. Each time a user makes a sale, they are assigned to this Affiliate_ID. Later and in the GA Report, you can see which partners made the most contribution to your sales.
Remember that the first two fixes are more rugged and will not be locked by certain enhancements (most likely), while Google Tag Manager and Google Analytics can be locked by enhancements such as Ghostery. Here is what we will do to track affiliate sales with Google Tag Manager and Google Analytics:
We verify the address of each page and if at any time it contains an affiliate ID, we retrieve it and save it in the cookies. Thereafter, we will transfer the value of the cookies to Google Analytics as a custom -sized custom dimension session. website cookies will not be sent to any third party. Follow a successfull buy. When the Partner ID is specified during this meeting, it is associated with this sale.
Watch how the affiliate ID appears in the Google Analytics customized reporting. First of all, you need to determine what type of request parameters you will use to distinguish affiliate traffic. What you will use is the following For this example I will use affiliate_id and the example URL will look like this: https://mywebsite.com/? affiliate_id=12345abc. For the 12345abc value to be stored in a GTM file, we need to perform 3 operations within GTM: a web address identifier that retrieves the value of an affiliate_id; a customized HTML tags that saves that value in a GTM file; a triggers that triggers that value.
When you are new to typing in the URL variables, please refer to this manual where I describe the specifics of parking webpages. Go to Variables > Custom Variables in Google Tag Manager and make a new tag with the following settings: The value of this value is returned if the current user URL contains an affiliate_id argument.
And if you haven't done so yet, please refer to this manual that describes the GTM and cookie friendships in more detail. Learn more about the following: Vary CookieName = "affiliate_id"; EpsonTime = EpsonTime * 1000; Vary Date = new Date(); Vary DataTimeNow = date. getTime (); date. setTime(dateTimeNow + expirationTime); var expirationTime= date. toUTCString(); Cookie's name is affiliate_id ( (line 2) and its value is added using the URL - affiliate_id variables (line 3).
Important: This tags must be triggered before the Google Analytics Pageview tags, so be sure to specify a higher fire precedence value in the custom HTML tags. Now we don't want to have anything wrong positive and we want to cause a cookiesetting day even if there is no affiliate ID in the link, so a certain triggers is required.
That means that if there is an affiliate_id argument in the address, this triggers it. Associate this trig with the HTML custom tags that create a cookie. Æ page 12345abc and press Enter. Refreshes the page and triggers a user-defined HTML tags (you can verify this in the Preview and Debug Console).
Let us now verify that a correct cookieset is used. The really easy and intuitional way to extend it allows me to quickly see which files are currently in use, what information they contain, when they run out, and so on. As soon as you have added this add-on, a cookie icon will appear next to the menu icon (in chrome).
Search for a Cookie called affiliate_id. That little bit of information will help us do some conjuring. To track affiliate sales with Google Tag Manager and GA, we need to build a customized affiliate ID dimensions that will later be associated with a visitorsession. Sign in to your Google Analytics Account, go to the admin panel, and in the properties pane go to User Definitions > User Defined Dimensions.
When you see a large box with a large orange NEUE ZOLLABMESSUNG icon, click it and generate the next dimension: Remember the number next to the "Dimension". GTM has a fairly simple function that allows you to browse through cookies, 1st-party Cookie variables.
You should if you still haven't begun using the Google Analytics preference variables. Rather than having to change more than one tag, you can only change one GA tag that is used in all GA tag types. Search your GTM pedestal for the Google Analytics Settings variables and manipulate them. So what we're going to do here is adding the user defined dimensions we did a few sections ago.
When the affiliate_id cookies contain a value, it is forwarded to Google Analytics. When it' not defined, Google does it and skips those settings so that no extra configurations are required. Recall how I said to you to note the number of the dimensions in section #3 of this manual?
Type this number in the GA Setting Variables Index box. Let's make a brief abstract of what we've done so far to track affiliate sales with Google Tag Manager and GA: First of all, we create a affiliate_id var which retrieves the value of the request var with a similar name (for those who don't know it, request var can be found in the web adress after the qualifier, e.g. https://www.mywebsite.com/? affiliate_id=12345abc).
We then took the value of the given HTML variables and saved it in the cookies, thanks to a custom HTML tags. For reading the value of this cookies, we have generated a 1rst part cookie value. We' ve used Google Analytics to create a custom Affiliate ID dimension and enter the index in the Google Analytics Settings variables.
In addition, the already mentioned 1. Party Cookies were added. In summary, if a user ends up on a page of your site and contains the affiliate_id link, GTM retrieves its value and stores it in the cookies. The value of this cookies is then immediately added to the GA preference variable as a user-defined domain value so that when a user makes a buy during this visit, it is associated with that affiliate as well.
So if a user exits the site without a buy and later ( e.g. after a day) comes back with the same unit and web browsers, a Cookie is still enabled, so its value is set back to GA Settings variable, so Google Analytics session get the affiliate ID again.
If someone talks about sales tracing in Google Analytics, he has e-commerce reporting in the back of his head. To track only sales, purchases, and any other information related to the end of the sale, use standard e-commerce tracing (I'll describe it a little in this guide).
When you want to track the visitor's whole trip to buy, include the phases such as Put in Shopping Basket, Initialized Checkout, etc., you will need to enter the following information to make the trip. Simply keep in mind that the more information you want to track, the more amount of your (or your developer's) resources you will need to spend. Let's say we only want to see the affiliate ID and how many orders it generated for us.
E-commerce trading standards are perfectly suited for this job. To make this kind of tracing work, we need to perform the following steps: Turn this on in Google Analytics reporting. Specify the precise time at which the sale is completed. Invite a development engineer to submit the transactions information to the datalayer.
A Google Analytics Transaction Day is created that retrieves information from the layer of information and transmits it to Google's server. When I say "we have to determine the timing of a purchase", I mean that we have to provide a catalyst. Learn more about tracing the Thank you page here. When the page does not refresh after the successful completion of the order, you should either try to track an AJAX request or ask a programmer to submit a customized purchasing incident to the database layer (with using our database layer. push) (the latter optional is recommended).
Learn more about the layer here and here. Once the purchasing information (order number, grand total, etc.) is sent to the layer, it is very important that the information is structured exactly as Google's records require. All parameter naming must be exactly as Google requests (e.g. transactionId cannot be changed to oderID, etc.).
Event':'purchase','transactionId':'1234', // the ID 1234 should be changed dynamic by the programmer with the current job ID. 99, })); your developers must activate this key after each successful buy. There will be no interruption to your deployment and you can also set up a buy button to initiate our GA transaction day.
Something else about this datenLayer. pushbutton with purchasing information: Not all boxes are mandatory. event':'purchase','transactionId':'1234', // the ID 1234 should be changed dynamic by the programmer with the current job ID. What we've done so far is "ask" a development engineer to transfer transactions to the layer when the job is actually over.
In addition, with this information we get a datalay even named "purchase", which is used to initiate GA Transaction Tags. And the best way to test if a development team has done everything right is to activate the GTM preview and debug modes and make a buy. When everything has been done right by the developers, a purchasing transaction should appear in the events streaming.
Select it and go to the Datalayer page. Developers must use this type of action to transfer the transactions that they want to look like: In case the incident did not occur, please verify with the developers if they have released the source codes for the website's/online shop's official state. In Google Day Manager, a day is only triggered if a specific trigger is enabled.
The best time to make a deal label is to use the above mentioned buying process. To do this, we need to build a custom events trig. Go to GTM >Triggers > New and select the Custom group. Note that the name of the events is case-sensitive. Once a programmer has moved the Buy occurrence to the data level, specify the same name ( capital P) in the Buy triggersettings.
Well, let's make a Google Analytics transaction day. Navigate to Tags > New > Universal Analytics and make the following settings: If GA Day Transaction's trace mode is Transaction, it verifies the layer and searches for transactionId, total, etc. as well. For this reason, a development engineer had to move the transaction information exactly according to the requirements of Google Doc.
When you have completed this stage, the following information will be plotted in the panel (P.S. readings may (and probably will) be different): When you have also sent some of your products you will see more rows in the panel. The most important squares are highlighted with a square: ec:tax: transaction tax. Here you can see the most important of them.
Last but not least, affiliate sales tracing with Google Tag Manager involves creating a sales reporting. From Google Analytics, go to Customization > Custom Reports. Please click on NEW CUSTOMS REVIEW and select the following MEASURES + Dimensions. You can see in the reports which partners generate the most revenues.
There is also another way how you can submit the affiliate ID. However, I have chosen the longer approach to show the performance of the mix of cookie, user-defined dimension, default e-commerce and user-defined reporting. Event':'purchase','transactionId':'1234', // the ID 1234 should be changed dynamic by the programmer with the current job ID.
They could have asked a programmer to look at the previously saved affiliate_id cookies and enter this ID in the Transaction Affiliation box when a data-level push is made. Google Analytics receives this information and this information is available in the e-commerce report. When this is the case, then the user defined dimensions is a way to transfer the affiliate ID.
Initially I had planned to release a completely different manual that would have covered affiliate sales tracing with GTM, but this section became so big that it became a separate blogs contribution. Throughout this advanced tutorial, I have shown you how to combine multiple techniques of tracking/tracking into one solution: Each time a user arrives on a page and the link contains an affiliate ID, that ID is retrieved and saved in the cookies.
The value of this cookies is then retrieved and transferred to Google Analytics as a user-defined domain size (session scope). When the value of the domain changes multiple time during a given meeting, the latest value is used. After that I described how to use a standard Ecommerce Tracking (Google Analytics) with the help of developers and data layers.
Once the sale is successfully complete, a user-defined GTM triggers a Google Analytics transaction. As long as a user has an affiliate cookie, its value is sent to Google Analytics so that you can see which ones generate the most revenue. It is possible to display this information with a basic user-defined reporting.
Do you have any ideas/suggestions on how to track affiliate sales with Google Tag Manager and Google Analytics?