Khoros Atlas Logo

%3CLINGO-SUB%20id%3D%22lingo-sub-434058%22%20slang%3D%22en-US%22%3ENeat%20idea%3A%20Add%20Google%20Analytics%20tracking%20codes%20to%20your%20community%20emails%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-434058%22%20slang%3D%22en-US%22%3E%3CP%3EI%20just%20implemented%20a%20pretty%20nifty%20little%20enhancement%20-%20I%20added%20Google%20Analytics%20tracking%20codes%20(UTM)%20to%20each%20of%20the%20links%20in%20the%20standard%20Lithium-sent%20emails.%20So%2C%20now%20I%20have%20some%20visibility%20into%20how%20much%20traffic%20these%20emails%20are%20generating.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20has%20been%20just%20over%2024%20hours%20since%20launch%2C%20so%20I%20don't%20have%20a%20ton%20of%20results%2C%20but%20it's%20really%20nice%20to%20know%20this%20data%20will%20be%20trickling%20in!%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20thought%20others%20may%20be%20interested%20in%20doing%20this%20to%20get%20some%20visibility%20into%20email%20usage.%20It's%20easy%20-%20just%26nbsp%3Badd%20the%20appropriate%20UTM%20codes%20to%20each%20of%20the%20URLs%20in%20each%20end-user-visible%20message%20template%26nbsp%3Bvia%20Studio.%20I%20decided%20to%20use%20source%3Dcommunitymembers%20and%20medium%3Demail%20for%20each%20of%20them%2C%20since%20I'm%20already%20using%20that%20scheme%20in%20marketing%20emails.%26nbsp%3BFor%20the%20campaign%2C%20I'm%20using%20the%20name%20of%20the%20template%20(the%20name%26nbsp%3Bfrom%20the%20URL%2C%20such%20as%20immediate_general%20for%20the%20%22General%20Subscription%20Notification%22)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EExample%3A%20An%20updated%20URL%26nbsp%3Bin%20the%20%22General%20Subscription%20Notification%22%20email%20(available%20in%20Studio%20at%3A%26nbsp%3Bhttps%3A%2F%2F%5BSTAGING-URL%5D%2Ft5%2Fbizapps%2Fbizappspage%2Ftab%2Fcommunity%253Astudio%253Atext-editor%253Aemail%3Femail%3Dimmediate_general%26amp%3Blang%3Den)%3A%3C%2FP%3E%3CBLOCKQUOTE%3E%3CA%20href%3D%22%26quot%3B%24%7Bnotification.message.webUi.url%7D%3Futm_source%3Dcommunitymembers%26amp%3Butm_medium%3Demail%26amp%3Butm_campaign%3Dimmediate_general%26quot%3B%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%24%7Bnotification.message.subject%7D%3C%2FA%3E%26nbsp%3B%3C%2FBLOCKQUOTE%3E%3CP%3ESome%20early%20results%20are%20that%20the%20%22General%20Subscription%20Notification%22%20(immediate_general)%20is%20leading%20the%20pack%20in%20terms%20of%20clicks%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20641px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Flithosphere.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F141684i56A3A43246C852AA%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20srcset%3D%22%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F141684i56A3A43246C852AA%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%201.0x%22%20alt%3D%22email-tracking.png%22%20title%3D%22email-tracking.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECheers!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-491456%22%20slang%3D%22en-US%22%3ERe%3A%20Neat%20idea%3A%20Add%20Google%20Analytics%20tracking%20codes%20to%20your%20community%20emails%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-491456%22%20slang%3D%22en-US%22%3E%3CP%3EAdded%20codes%20today%2C%20tomorrow%20morning%20I%20push%20changes%20to%20production.%20Interesting%20to%20see%20the%20first%20data%20%3CIMG%20class%3D%22emoticon%20emoticon-smileyhappy%22%20id%3D%22smileyhappy%22%20src%3D%22https%3A%2F%2Flithosphere.i.lithium.com%2Fi%2Fsmilies%2F16x16_smiley-happy.png%22%20alt%3D%22Smiley%20Happy%22%20title%3D%22Smiley%20Happy%22%20%2F%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-491190%22%20slang%3D%22en-US%22%3ERe%3A%20Neat%20idea%3A%20Add%20Google%20Analytics%20tracking%20codes%20to%20your%20community%20emails%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-491190%22%20slang%3D%22en-US%22%3E%3CP%3EYes%20it%20is%20a%20start%20and%20actually%20it%20is%20a%20good%20start.%3C%2FP%3E%3CP%3EFor%20example%3A%20Normally%20you%20see%20that%20there%20is%20active%20thread%2C%20people%20are%20posting%20a%20lot%20and%20you%20see%20how%20many%20different%20user%20are%20posting.%20With%20these%20tags%20you%20can%20track%20how%20many%20times%20members%20comes%20to%20the%20community%20because%20they%20got%20email%20%E2%80%9DYou%20got%20new%20answers%E2%80%9D%20but%20they%20dont%20post%20to%20the%20thread%20%E2%80%94%26gt%3B%20you%20see%20perspective%20how%20interested%20members%20are%20about%20that%20thread%20anyways%20(they%20have%20posted%20earlier%20but%20they%20dont%20want%20to%20post%20any%20more%20etc%20but%20they%20are%20still%20interested).%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-478617%22%20slang%3D%22en-US%22%3ERe%3A%20Neat%20idea%3A%20Add%20Google%20Analytics%20tracking%20codes%20to%20your%20community%20emails%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-478617%22%20slang%3D%22en-US%22%3E%3CBLOCKQUOTE%3E%3CHR%20%2F%3E%40Wendy_S%26nbsp%3Bwrote%3A%3CP%3EI%20wonder%2C%20do%20you%20have%20a%20way%20of%20knowing%20how%20often%20a%20certain%20notification%20is%20send%20and%20then%20how%20often%20the%20links%20are%20clicked.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CHR%20%2F%3E%3C%2FBLOCKQUOTE%3E%3CP%3EHi%26nbsp%3B%3Ca%20href%3D%22https%3A%2F%2Fcommunity.khoros.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F3374%22%3E%40Wendy_S%3C%2Fa%3E%26nbsp%3B-%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJust%20realized%20I%20never%20responded%20to%20this%20one.%20Nope%2C%20I%20don't%20know%20how%20often%20a%20certain%20notification%20is%20sent%2C%20just%20how%20often%20the%20links%20are%20clicked.%20But%20it's%20a%20start!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECheers!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-478615%22%20slang%3D%22en-US%22%3ERe%3A%20Neat%20idea%3A%20Add%20Google%20Analytics%20tracking%20codes%20to%20your%20community%20emails%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-478615%22%20slang%3D%22en-US%22%3E%3CP%3EYes%20this%20would%20be%20a%20great%20feature%20to%20have%20and%20add!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-434883%22%20slang%3D%22en-US%22%3ERe%3A%20Neat%20idea%3A%20Add%20Google%20Analytics%20tracking%20codes%20to%20your%20community%20emails%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-434883%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20for%20sharing!%3C%2FP%3E%0A%3CP%3EI%20wonder%2C%20do%20you%20have%20a%20way%20of%20knowing%20how%20often%20a%20certain%20notification%20is%20send%20and%20then%20how%20often%20the%20links%20are%20clicked.%3C%2FP%3E%0A%3CP%3EI%20like%20the%20idea%20of%20trying%20this%20but%20thus%20far%20have%20not%20been%20seeing%20a%20way%20to%20know%20the%20total%20nr%20of%20notifications%20send%20out.%3C%2FP%3E%0A%3CP%3ECheers%3C%2FP%3E%0A%3CP%3EWendy%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-434461%22%20slang%3D%22en-US%22%3ERe%3A%20Neat%20idea%3A%20Add%20Google%20Analytics%20tracking%20codes%20to%20your%20community%20emails%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-434461%22%20slang%3D%22en-US%22%3E%3CP%3ESo%20this%20is%20neat%20-%20I%20just%20awarded%20badges%20to%201%2C100%20members%20based%20on%20certifications%20they've%20earned%20outside%20the%20community%20-%20and%20I%20can%20see%20that%20199%20people%20clicked%20on%20the%20badge%20notification%20email%20to%20see%20their%20badge.%2018%25%20clickthrough%20is%20pretty%20great!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20606px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Flithosphere.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F141720i0FF2421C41CB32AD%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20srcset%3D%22%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F141720i0FF2421C41CB32AD%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%201.0x%22%20alt%3D%22image.png%22%20title%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Honored Contributor Honored Contributor
Honored Contributor

Re: Neat idea: Add Google Analytics tracking codes to your community emails

Don't the URLs in many of the email notifications have anchors (eg. #M3214) when referencing a post? I would assume that putting tracking parameters on the end of this URL would either break the tracking or break the anchor (or both).

@CarolineS you seem to have the tracking coming through, have you done this with any notifications that include a post URL? If so, what was the experience like?

Reply
Loading...
Highlighted
Honored Contributor
Honored Contributor

Re: Neat idea: Add Google Analytics tracking codes to your community emails

A most excellent question, @DanK. I looked up the code I added to the email templates, and it's along the lines of:

 

<a href="${notification.messageUrl}?utm_source=communitymembers&utm_medium=email&utm_campaign=subscription_digest">View</a>

 

This creates links like:

https://community.meraki.com/t5/Community-Announcements/A-Guest-Community-Challenge/bc-p/61215#M3001?utm_source=communitymembers&utm_medium=email&utm_campaign=subscription_digest

The "?" in this URL then seems to automatically convert into the URL-encoding for the "?", or %3F - see below:

https://community.meraki.com/t5/Community-Announcements/A-Guest-Community-Challenge/bc-p/61215#M3001%3Futm_source=communitymembers&utm_medium=email&utm_campaign=subscription_digest

Which means I'm actually not getting tracking for these links that have anchors! Good to know! Not sure if there's a solution to this? Any ideas?

 

0 Kudos
Reply
Loading...
Highlighted
Honored Contributor Honored Contributor
Honored Contributor

Re: Neat idea: Add Google Analytics tracking codes to your community emails

I was playing around yesterday as I am keen on getting tracking into our templates for the exact reasons that you did.

One thing that I did discover is that you can do is change the URL variable ${notification.message.webUi.url} to ${notification.message.discussion.webUi.url} and it will return the URL for the topic rather than the post, which means that it does not take the user directly to the message in question (removing the # anchor parameter). This makes the tracking work but it doesn't take the user to the specific comment that generated the notification.

This is okay in a situation where a solution is involved on my community, as we float those to the top, but I suspect it would be a poor user experience for a reply notification in the instance of a multi-page thread as it wouldn't even take the user to the right page let alone the right comment.

When replying to this specific thread here I noticed that the Khoros Atlas team have actually put the codes on the end of the URL and encountered the same issue;

community.khoros.com/t5/Khoros-Community-Discussions/Neat-idea-Add-Google-Analytics-tracking-codes-to-your-community/m-p/567919#M9214%3Futm_source=communitynotification&utm_medium=email&utm_campaign=mentions

I am not 100% sure how the email templates work but I suspect to get a good user experience you would need to be able to store variables as strings, cut them up and them put back together with the tracking between the URL and the anchor strings. Perhaps someone with a bit more dev in their title could work something out 😛

 

Reply
Loading...
Honored Contributor
Honored Contributor

Re: Neat idea: Add Google Analytics tracking codes to your community emails

@DanKgood find that Khoros themselves have this error too! Agree that it’s not a great solution to just remove the anchor, especially as some discussions get looooooong. 

I do wish Khoros would just provide some amount of email tracking so we didn’t need this hacky solution anyway!

Cheers!

0 Kudos
Reply
Loading...
Highlighted
Honored Contributor Honored Contributor
Honored Contributor

Re: Neat idea: Add Google Analytics tracking codes to your community emails

Okay, so it has been ~15 years since I dropped out of my programming course at uni so there may be a more elegant solution than I have found BUT I have found a way to keep the anchor.

I have highlighted in red the parts that you will need to change to suit your requirements but basically the code below takes the URL, checks for a # and if one is found splits it into two text strings (one containing the URL without the anchor and the second containing just that value eg. #M1234 ). Then the URL is reconstructed by inserting your UTM parameters between the two parts and setting it as a variable you can use

#set ( $tempurl = ${notification.message.webUi.url})#if( $tempurl.contains('#'))
#set ($hashindex = $tempurl.indexOf('#'))
#set ($urlstart = $tempurl.substring(0,$hashindex))
#set ($urlend = $tempurl.substring($hashindex))
#set ($tempurl = "${urlstart}?utm_source=community&utm_medium=email${urlend}")
#else
#set ($tempurl = "${tempurl}?utm_source=community&utm_medium=email")
#end

I put this code towards the top of the template and then simply used my new variable $tempurl in place of all references to the message url within the template.

Note that the code must precede any attempts to use the variable or it will break (hence why I put it towards the top).

EDIT: I just realised the original solution did not put tracking on when the URL had no # (although I will be using it where I KNOW a # exists) so I have added an else statement to do that.

Reply
Loading...
Highlighted
Honored Contributor
Honored Contributor

Re: Neat idea: Add Google Analytics tracking codes to your community emails

Wow, @DanK, awesome! I'll steal this!

0 Kudos
Reply
Loading...
Highlighted
Occasional Advisor
Occasional Advisor

Re: Neat idea: Add Google Analytics tracking codes to your community emails

Thanks @DanK !

0 Kudos
Reply
Loading...