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
/** | |
* JS that gets Google Universal Analytics custom dimension slots that are in use by active (running) experiments. | |
* Execute in console on website with correct Optimizely snippet | |
*/ | |
console.log("All Google Universal Analytics Custom Dimensions in use by active experiments:"); | |
for (var experiment in optimizely.allExperiments) { | |
if (optimizely.allExperiments[experiment].enabled == true) { | |
if (typeof optimizely.allExperiments[experiment].universal_analytics == 'object') { | |
console.log("Experiment: " + experiment + ". Custom Dimension used: " + optimizely.allExperiments[experiment].universal_analytics.slot); | |
} |
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
/* _optimizely_redirect=http://www.example.com */ | |
/* remove Query Parameter from url */ | |
_optly = {redir: document.createElement("a")}; | |
_optly.redir = {protocol: "https:" == document.location.protocol ? "https://" : "http://", | |
domain: window.location.hostname, | |
pathname: window.location.pathname | |
}; | |
queryToRemove = "TO_REPLACE"; | |
_optly_cur_loc = window.location.href; |
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
/** | |
* This code will help assign all your visitors to either a new or returning dimension. | |
* This helps attribute conversion events to new/returning visitors. | |
* I've written this code to replace the new/returning audience conditions enabled for segmentation that many customers use. | |
* | |
* Instructions: | |
* Set up a new dimension called new/returning visitors as per this URL: https://help.optimizely.com/Target_Your_Visitors/Dimensions%3A_Capture_visitor_data_through_the_API | |
* Dimension Name: "New / returning visitor" | |
* Dimension Description: "New or returning visitor to your site. Helps attribute conversions to new or returning visitors." | |
* Dimension API Name: "new_returning_visitor" |
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
/* _optimizely_redirect=http://www.example.com */ | |
var toReplace = "/[TO_REPLACE]"; | |
var newString = "/[NEW_STRING]"; | |
var _optly = {redir: document.createElement("a")}; | |
_optly.redir = {protocol: "https:" == document.location.protocol ? "https://" : "http://", | |
domain: window.location.hostname, | |
first: window.location.href.split(toReplace)[0], | |
second: window.location.href.split(toReplace)[1], | |
query: window.location.search | |
}; |
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
/** | |
* OPTIMIZELY CUSTOM CLICK EVENTS FRAMEWORK | |
* customClickEvent.js | |
* Version 1.0 | |
* | |
* @install: You can add the following code to your Experiment JavaScript or Project JavaScript | |
* Replace the SELECTOR with the jQuery selectors of the element(s) you're looking to track | |
* Replace CUSTOMEVENTGOAL with the name of your custom event goal (eventName) | |
* | |
* @explanation: This code fires a custom event goal for Optimizely. For mobile visitors, it |
NewerOlder