Created
September 9, 2020 21:30
-
-
Save maestrojed/278fca350e936b00abe5bc20368c8095 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Look for and use Linkwell Source, Medium, and Campaign parameters. Override any UTM data | |
sourceParam = new RegExp('[\?&]source=([^&#]*)').exec(window.location.href); | |
if (sourceParam !== null){ | |
var source = ""; | |
source = decodeURI(sourceParam[1]) || 0; | |
ga('set', 'campaignSource', source); | |
} | |
mediumParam = new RegExp('[\?&]medium=([^&#]*)').exec(window.location.href); | |
if (mediumParam !== null){ | |
var medium = ""; | |
medium = decodeURI(mediumParam[1]) || 0; | |
ga('set', 'campaignMedium', medium); | |
} | |
campaignParam = new RegExp('[\?&]campaign=([^&#]*)').exec(window.location.href); | |
if (campaignParam !== null){ | |
var campaign = ""; | |
campaign = decodeURI(campaignParam[1]) || 0; | |
ga('set', 'campaignName', campaign); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment