This file contains hidden or 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
| { | |
| "schema_version": "1.0", | |
| "agent_type": "specialized", | |
| "name": "Get Experiments Report", | |
| "output": { | |
| "type": "text", | |
| "schema": null, | |
| "description": null | |
| }, | |
| "version": "1.0.0", |
This file contains hidden or 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
| function getTotalOrderAmount() { | |
| let price = document.querySelectorAll('div > div.a-column.a-span2 > li > div:nth-child(2) > span') | |
| let count = 0 | |
| price.forEach(function(element){ | |
| let priceString = element.innerHTML.replace('$', ''); | |
| let priceFloat = parseFloat(priceString); | |
| count += priceFloat; | |
| }); | |
| return count; | |
| } |
This file contains hidden or 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
| // Inject Optimizely script immediately | |
| (function() { | |
| 'use strict'; | |
| console.log('🚀 Optimizely injection script starting...'); | |
| console.log('📍 Current URL:', window.location.href); | |
| console.log('📊 Document ready state:', document.readyState); | |
| // Function to inject the Optimizely script | |
| function injectOptimizelyScript() { |
This file contains hidden or 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
| // [WARNING] You must disable 'Mask descriptive names in project code and third-party' in this project's settings for this to work! See here https://support.optimizely.com/hc/en-us/articles/4410284343181-Project-Settings-Privacy#01H84ETPDDFDXMTYDWWAX92EKG | |
| var decisionObject = window.optimizely.get('state').getDecisionObject({ | |
| campaignId: campaignId, | |
| shouldCleanString: true | |
| }); | |
| var utils = window.optimizely.get('utils'); | |
| function sendToAnalyticsProvider() { |
This file contains hidden or 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
| (function() { | |
| 'use strict'; | |
| console.log('🚀 Zaius injection script starting...'); | |
| console.log('📍 Current URL:', window.location.href); | |
| console.log('📊 Document ready state:', document.readyState); | |
| // Function to inject the Zaius script | |
| function injectZaiusScript() { | |
| console.log('🔧 Starting Zaius script injection process...'); |
This file contains hidden or 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
| // Constant for consistent event naming | |
| const OPTIMIZELY_EVENT_NAME = 'Optimizely_Experiment'; | |
| // Helper function to safely retrieve the FullStory API | |
| // You may want to add code to wait for it to be available | |
| function _fs() { | |
| const fsNamespace = window['_fs_namespace']; | |
| const fsApi = fsNamespace && window[fsNamespace]; | |
| return typeof fsApi === 'function' ? fsApi : () => {}; | |
| } |
This file contains hidden or 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
| function getUserInfo(user_id){ | |
| // Add logic to check if (store_id_boolean is in local storage and not expired value) | |
| fetch('https://tapi.optimizely.com/api/js/odds/project/<project_id>?project=<project_id>&c_user_id=' + user_id).then(function (response) { | |
| // The API call was successful! | |
| return response.json(); | |
| }).then(function (data) { | |
| // Recommended to cache this user data for a period of time so you are not making requests for user info on every page load | |
| return data | |
This file contains hidden or 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
| { | |
| "plugin_type": "widget", | |
| "name": "Optimizely Product Recommendations", | |
| "edit_page_url": "https://p13n.opti-demo.online/", | |
| "form_schema": [ | |
| { | |
| "name": "header", | |
| "options": null, | |
| "label": "Header Text", | |
| "default_value": "You might also love", |
This file contains hidden or 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
| import { enums } from '@optimizely/optimizely-sdk'; | |
| // import your third-party analytics integration here | |
| /////////////////////////////////////////// | |
| // SET UP DECISION NOTIFICATION LISTENER // | |
| /////////////////////////////////////////// | |
| const onDecision = ({decisionType, userId, attributes, decisionInfo}) => { | |
| if(decisionInfo['decisionEventDispatched']){ | |
| // This assumes the userContext is instantiated | |
| // Ensure Contentsquare is available |
This file contains hidden or 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
| async function checkIPAddress() { | |
| // Using a public IP API service to get the visitor's IP | |
| const response = await fetch('https://api.ipify.org?format=json'); | |
| const data = await response.json(); | |
| const visitorIP = data.ip; | |
| return visitorIP | |
| } | |
NewerOlder