Showing posts with label Google Analytics. Show all posts
Showing posts with label Google Analytics. Show all posts

Sunday, February 21, 2021

Overview of Adobe Experience Platform Event Forwarding

Happy (belated) New Year 2021! There is no denying the fact that the introduction of the Adobe Experience Platform Web SDK has revolutionized data collection. There are a lot of advantages of this approach but the main ones are reduced page latency, fewer cookies, a consolidated tracking library and the ability to directly stream data to Adobe Experience Cloud solutions to name a few. It's no surprise that Adobe is openly propagating this approach as the recommended path to implement all client-side solutions moving forward. I coauthored a post about the high level migration approach to the Web SDK on Adobe's official Medium blog site.

Assuming that we know the basics of the Adobe Experience Platform Web SDK, XDM and setting up the AEP schemas & datasets which will all apply in this case, this article will solely focus on Event forwarding which is a recently launched service by the Adobe data collection team. I'm working with one of my clients to evaluate the feasibility of this feature and have already set this up on my sandbox which I'll cover in this article.

Overview and Use Case


Event forwarding allows customers to federate or distribute data to a 3rd party platform such as Google Analytics or any system that has an API endpoint. The data is first collected from the page via the Adobe Web SDK client-side library and then sent over to a 3rd party endpoint from the Adobe Edge network. Even though it is called Event forwarding, data still needs to be collected at the source on the page.

The primary use case for leveraging this feature is to stream data in real-time to a Data Lake for on-site personalization, decisioning or simply for data collection to run offline queries, build dashboards or create ML models.

You can essentially leverage the implementation you have on your website to send data directly to your Data Lake which isn't very common for a lot of clients who usually send hourly or daily data feeds to their backend platform. With this, they can basically collect cherry picked data which is streamed in near real-time.

Architecture


I had originally created this simplified architecture diagram for a blog I wrote explaining the AEP Real-Time CDP which I've slightly tweaked to explain the concept of the how data is federated server-side to 3rd party platforms (explained in 3b). Basically, the AEP Edge Network is the system that federates data both to our own Adobe solutions and to 3rd party platforms.



Steps to Implement


In this section, I will cover how to implement this in Tags (formerly Launch) and also show how to collect data streamed from my sandbox using ngrok which is a localhost webhook development tool that allows me to make my endpoint URL public. Please note that I'll just cover the basic steps that will help you make a call to a 3rd party endpoint but a more exhaustive tutorial on this can be found here. So let's take a look.

The first step is to create a separate property under the Server Side section by clicking on the drop down as shown below. Please note that you will not have access to this by default so please contact your Adobe Customer Success Manager to request access and get details around licensing.


The next step is to create a new property (Rohan's Test in my case) in this section and add the extension called "Adobe Cloud Connector". Please note that there's another extension which allows you to federate data to Google Analytics as well.


Next, we need to create a new API endpoint. I'm using ngrok to map it to create a public facing URL tied to port 3000. The public facing domain ends with f3cc.ngrok.io.


I have a Node.js webhook (mapped to port 3000) which I ran while doing this test. I mapped the ngrok domain to my webhook/API endpoint and modified the URL to add '/ssftest' which is my final API endpoint URL.


The next step is to enable the toggle to enable Event forwarding and pick your newly created property ID and Environment.


Next, we need to a new rule tied to the Adobe Cloud Connector extension and pick the option called "Make Fetch Call". Please note that you can also need to create new data elements in this property in case you want to pass any additional data to your API endpoint.


Next, I mapped the API endpoint URL within the action. In this screen, we have the option to make different types of calls but in my case, I'm going to make a POST request. Note that I am also sending some test query string parameters as part of the JSON request. We can also add the XDM data and send it in the body of the request.


Finally, we need to go to the website and load the page with the Web SDK deployed which is the ideal scenario. In my case, my sandbox already has the AEP Web SDK deployed so as soon as I refresh the page, a call gets made both to Adobe Experience Platform and to my webhook (API endpoint).


Here, I can see the query string parameter I sent in the request and some default parameters which also get sent in. If I would've sent in the XDM data object, you would've seen it here too.


What Else Would I Like to See


Below are a few additional things I'd like to see included in Launch Server Side:

  • The ability to do the same thing on a mobile app client-side implementation. Adobe is working on a Mobile app equivalent of the Web SDK so hopefully we'll see it soon.
  • It'll be great if the Launch Server Side team can collaborate with the Data/Bulk Ingestion API team and see if they can come up with shared learnings to standardize server side data collection within Adobe's own solutions as well.
  • Being able to replicate the same data elements created in the client-side Launch property to avoid redundancy.
  • Include more extensions in addition to Google Analytics to federate data server side which is collected by the Edge Server . This will hopefully allow clients to get rid of additional 3rd party scripts from the page such as Facebook and Google conversion pixels.

Even though this is a relatively new service, I'm confident it will become more and more popular as we get closer to the impending deprecation of 3rd party cookies and introduction of more stringent data sharing policies. Hope you found this post helpful and please don't hesitate to reach out with any questions!

Sunday, May 24, 2020

Visualizing Traffic on my Blog using R

I've been a data analyst in the past and one thing I can say for sure is that we don't have to be great analysts or statisticians to be able to read basics graphs and understand trends. Visuals are all around us whether it's stock market trends or data around the dreaded Covid-19 pandemic. By now, I'm sure all of us have heard about "flattening the curve". It literally took a pandemic for us to know what it means but the point I'm trying to make is that we are surrounded with data and people should ideally know how to understand it. I recently learnt the basics of R, which is a programming language mostly used in data analytics, statistical analysis and visualization. R is a good language to learn for data analysts and statisticians which resonates really well with professions who know SQL. 

In this post, I'll visualize traffic coming to my blog since 2017 (data captured in Google Analytics) and show some commonly used graphs and visualizations using R Studio. The most obvious trend you'll see is traffic started gradually increasing on my blog since I started writing again in January-18 and has really spiked in the last few months. So, let's dive in!



Basics of R


As I explained earlier, R is a programming language used to analyze existing trends and also do predictive analytics using statistics. For the purposes of this article, I'm using R Studio to run basic R commands to create simple visuals such as bar graphs, line graphs and slightly more complex visuals such as bubble charts, word cloud and a map using some commonly used packages. 



Data Frame


The first step before doing any analysis in R is data wrangling which is manipulation and transformation of data in a format which you can use for analysis. In R, we do the same thing by creating a data frame which is essentially a table that is populated typically by importing a .CSV file but other formats such as SPSS or Stata are also supported for advanced use cases. 

A data frame contains rows and columns and can be compared to an Excel spreadsheet. The other thing to keep in mind is that it's okay to do some data transformation in the source file itself before bringing data into R but a lot of the manipulation is done directly in R itself. In my case, I modified the source .CSV files exported from Google Analytics for basic data formatting such as switching the metrics to Number format as an example. The command to bring data into R via a .CSV file is: 

where df is the data frame, read.csv is the function which reads a .CSV file and stringsAsFactors = FALSE ensures that the data is not converted into a factor to keep the source data format intact. The original file contained Page name and some common metrics such as Page views, Visits etc.


Package


R packages are reusable code libraries that provide additional functionality to R and help simplify tasks. You can install packages using the install.packages() function and invoke them using the library() function. In my case, I'm using the following packages:


  • library(ggplot2)
  • library(lubridate)
  • library(ggwordcloud)
  • library(maps)
  • library(dplyr) 

Finally, before we take a look at the visuals, one other thing to note is that I did some basic data manipulation in R to convert the Month and Year using the lubridate library by using the ymd() and mdy()  functions. There are a lot other things that I can cover under basics but that's outside the scope of this post.


Visualizing Blog Traffic Trends


In this section, I've inserted the graphs created in R Studio which were saved as images. I've used the "ggplot2" package which is a very popular R library to visualize data. I'll admit that my blog does not get a ton of traffic but that is not my intent as I'm not into any competition to artificially inflate my traffic. My intent is to share what I know with others and document things for myself for future reference. Let's take a look at some of the trends.



Show Visits and Page Views for the Last 3 Years (Line)


In this line graph, I've visualized Visits (called Sessions in Google Analytics) and Page views for the last 3 years. 





  • If you notice closely and look at the label I manually added, traffic started gradually increasing once I started writing again in early 2018. 
  • The biggest spike happened Thanks to my last post about Real-Time CDP which I wrote last month. This shows how much my readers want to consume content about the latest and greatest technology from Adobe and especially if it's around Adobe Experience Platform.

I mentioned earlier that it's very common for analysts to modify the source data before bringing in the data in R which is what I did to generalize the page names by removing the month and year using the mid() function in Excel.





As promised, here's the code sample to generate this visual. Please note that I created a separate data frame called 'dfl' which contained Month, Visits and Page views. Also, note that the file format is .rmd which is a format used to visualize R commands. 




Top 10 Pages Visited from Jan-2017-Apr-2020 (Flipped Bar Graph)


In this bar graph, I'm showing the top 10 page Visits by Page in the last 3 years. 





  • The most popular page is the one I wrote to show the calculation of funnel drop off rate way back when I started blogging. This shows that there's still a sizable audience looking for calculation of basic metrics such as drop off rate as the traffic source of this page is primarily search engine.
  • The other popular pages is the homepage which may mean that people get sent directly to my homepage via search. Again, this is inclusive of the last 3 years worth of data so more analysis is needed to understand this fully which is outside the scope of this post.
Below is the code I wrote.


Top 10 Pages by Visits and Bounce Rate from Jan-2017-Apr-2020 (Bubble Chart)


In this chart, I show the top 10 pages (last 3 years) visualizing Visits and Bounce Rate. The color of the bubble is the page name and the size of the bubble is tied to Visits.



  • The most popular page name (drop off rate) has the highest Bounce Rate and Visits which shows that readers searching for drop off rate who come to my blog are MOSTLY interested in this type of content and nothing else.
  • The homepage ("/") has the lowest Bounce Rate of 66% which is obvious because users typically either search or click into a post which they came to read as opposed to just stay on the homepage.

Below is the code snippet.



Top Traffic Sources from Jan-2017-April-2020 (Stacked Area Chart)


In this chart, I visualize the top traffic source sending traffic to my blog for the last 3 years.





  • Organic search has traditionally been the top traffic source for my blog but the interesting thing is that a lot of visitors come directly to my blog by typing the URL which is very surprising to me unless they bookmark it.
  • Traffic via Social channels started appearing since I started sharing my blog posts on LinkedIn and Twitter from early 2018 which explains the trend.

Below is the code snippet.




Age and Gender Data Captured since late 2018 (Pie Chart and Bar Graph)


Now, this might be a bit surprising for some Adobe Analytics users to understand how Google Analytics captures demographic data. This is done by enabling the Demographics and Interests reports  in Google Analytics which uses data collected from IDFA and Google advertising cookies to help in retargeting. Again, none of this data shown here is even borderline PII so Google has taken into consideration all privacy regulations. It might be a good addition for Adobe Analytics if it can receive similar data from the Adobe Ad Cloud platform.




There's not much to say here as these graphs are self-explanatory but I manually added the percentage (total is ~5500 Visitors) to show the breakdown of Gender in the Pie chart. The code snippet is show below.



Word Cloud showing Internal Search Terms since early 2019


Word cloud is a commonly used visual to show search terms or popular tags which people are looking at. I've imported the "ggwordcloud" package to do this. 



  • Given that I've written extensively about Adobe Audience Manager, it's not surprising that a lot of the search terms are tied to AAM.
  • This also tells me what else I can write about based on what people are searching for.

Below is the code snippet.



Map Showing Visitors by Country from Jan-2017-April-2020


Finally, this visual created using the "maps" and "viridisLite" (already available in R) packages shows which country is the most popular in terms of the total number of Visitors. As shown below, United States is the most popular followed up by India which are the two countries I'm associated with so I'm not surprised :)



Below is the code snippet for this.



Adobe Experience Platform Data Science Workspace


One of the best things about Adobe Experience Platform is that it provides you the ability to run SQL queries and run ML algorithms or models directly on the data (in XDM format) in the tool which has never been the case in the past. This is super powerful and completely eliminates the additional time it would take to export the data and make it available in a platform outside of Adobe. 

Data Science Workspace integrates Jupyter notebooks which is very popular open source application that allows you to run ML models, perform data visualization written in programming languages such as Python. The reason why I'm mentioning it in this post is because it can also run code written in R so theoretically everything that I showed you can work in Data Science Workspace but my understanding is that it requires the underlying data to be in XDM format. I haven't dabbled with it due to data access constraints but here's how you can access DSW and run R commands in case you have access.





So that was it! Hope with this post, I piqued your curiosity about R and its data visualization capabilities.

Monday, June 1, 2009

My take on 404 Error Page Naming and Analytics

‘404 Error Pages’ are the pages displayed when someone is not able to find a link/URL on a website. There are usually 2 ways by which one can find the 404 page:

1) Typing in the wrong URL: If a visitor has typed a wrong URL, by default he will see a ‘The Page cannot be found’ page in case there is no custom 404 page present in the website. Below is a screenshot of such a page.

In order to fix this, the best practice is to create a custom 404 page which will be shown to visitors who try to access a page which has either been removed or doesn’t exist. This 404 page should contain links to the most important pages of your website and will play an important role in engaging visitors back to your website. You can also create 404 pages which have a funny message. Some examples of such pages can be found here.


2) Deleted or moved links: The same default page mentioned above will appear in case a visitor clicks on a link/page that has either been deleted or moved to a new location.

To fix this, implement 301 redirects which send visitors to the new page which has been moved to a new location.

As far as Web Analytics tracking is concerned, it is pivotal to accurately track how many people are looking at the 404 page and what URLs are they looking for. The method explained below will help you track 404 pages efficiently (Tracking impressions on the 404 page and the incorrect URL) through Omniture and Google Analytics.

1) Adobe Analytics: Capture the incorrect URL (JavaScript function document.location) in the s.pagename variable and append ‘404’ to it as shown below.
s.pageName="404:"+document.location (E.g. If the incorrect URL is http://www.undp.org/ss, then the pagename variable will capture it as ‘404:http://www.undp.org/ss’. This naming structure helps in gauging the amount of traffic going to incorrect pages as well as fixing broken links. Similarly pathing can be performed on the error page to find the flow of traffic to and from this page.
• Another mandatory variable which should be populated on error pages is s.pageType which should be populated as s.pageType="errorPage".
Below is a screenshot of the UNDP 404 page using similar Omniture snippet.



2) Google Analytics: Capture the incorrect URL in the trackPageview function as shown below:
pageTracker._trackPageview("404:" + document.location) (E.g. If the incorrect URL is http://seattleindian.com/seattle/xyz.asp, then the value captured in the ‘utmp’ variable will be ‘404:http://seattleindian.com/seattle/xyz.asp’.
Below is a screenshot of the SeattleIndian 404 page using similar Google Analytics snippet.


Below are some advantages of implementing custom 404 pages in your website:

1) Engaging visitors to pivotal pages of your website: If your 404 error page has links to important pages of your website, users can be sent to important pages of your website thereby increasing user engagement. You should also add a link to the sitemap page and a search box.
2) Leveraging Web Analytics to optimize your website: You can utilize Web Analytics tools by analyzing 404 URLs which users type and fix broken links on your website.
3) Reduces user frustration: Creating a custom 404 page eases user frustration caused due to not being able to find what they were looking for.

Monday, May 25, 2009

Small Change with a Huge Impact

Recently I was involved in changing the layout of a website and measuring the impact of that change. We changed the Top navigation on this website and changed the color of a link to Red/Bold. It was a very minor change with respect to the whole website as the Top navigation menu only contributed to less than 5% of users engaging in the website. We wanted to make this change to enhance the Top navigation and entice more clicks on the edited link (Coupons). P.S. We leveraged Google Analytics to measure this change. Below is a screenshot of the previous Top Navigation menu:


After a week, I pulled the ‘Top Content’ report and filtered on the Top menu Coupons link. I was pleasantly shocked to notice the results. There was a 65% increase in User Engagement (Clicks) on the Top navigation Coupons link clearly due to changing the link color to Red. From the context of the website, this page amounts only to a small proportion of traffic but this change has paved the way for similar changes which can be replicated on others pages in the future. Below is a screenshot of the change we made on the Coupons link:


Immediately after noticing this change I sent a tweet in excitement: ‘Wow! Top menu navigation link text change resulted in over 60% increase in user clicks. Changed the font of the link to Red/Bold #ga #wa’. Surprisingly, I got a response from a Twitter user: ‘So funny. We also changed the nationalgeographic.com top nav to red/bold in Dec 07 for commerce promo. It stuck.’ The user mentioned that Nationalgeographic also made a similar change back on 2007 and they too noticed an increase in clicks on the button. Isn’t it coincidental?

Going forward we plan to replicate the same exercise on the Side menu. We will also be performing AB Tests on the Top navigation menu and compare it with newer menus. P.S. It is always a good practice to add a query string parameter in the URL. E.g. Add ‘menu=top’ (http://www.seattleindian.com/seattle/indian-restaurant-coupons.asp?menu=top) to distinguish this URL as a Top navigation link.

Hope you like this article. Please comment and let me know if you’ve done similar exercises and noticed a considerable impact.