3rd party integrations
...
Purple Analytics Readmode
Migration Guide
17 min
overview this guide explains how to use claude to migrate your purple analytics readmode custom js file to the new architecture using the readmode loader js base prerequisites access to claude code or claude with file processing capabilities your existing custom js file the new readmode loader js file step 1 prepare migration folder create a new folder called migration in your project directory copy the following files into the migration folder your existing custom js file the new readmode loader js file mkdir migration cp custom js migration/ cp readmode loader js migration/ step 2 navigate to migration folder change your working directory to the migration folder before starting claude cd migration important you must run claude from within the migration folder for the migration to work properly step 3 run claude migration option a using claude code cli if you have claude code installed, run it from the migration folder claude option b using claude web interface open claude in your web browser upload both files ( custom js and readmode loader js ) to the conversation step 4 provide migration instructions copy and paste the following instructions to claude create an updated custom js file for purple analytics readmode migration with the following requirements 1\ start with the complete readmode loader js file as the base 2\ copy all code from readmode loader js exactly as is (do not modify any of the core code) 3\ locate the comment "insert your custom code here" in readmode loader js 4\ add all custom code from the provided legacy custom js file after this comment 5\ use the hooks system to integrate custom functionality \ place configuration variables in the custom section \ place custom functions in the custom section \ use purpleanalyticsreadmode oninitialized hook for initialization logic \ do not add any custom tracking or page change monitoring code 6\ the output should be a complete custom js file that replaces the current one 7\ do not change any code from readmode loader js only add custom code in the designated section 8\ exclude any analytics tracking, monitoring, or page change detection functionality please generate the complete updated custom js file content without any custom tracking features and save it to custom migrated js step 5 review migration output claude will create a new file called custom migrated js that contains complete readmode loader js base all core functionality preserved exactly as is custom code integration your existing custom code added in the designated section hook based architecture custom functionality integrated using the new hooks system oninitialized() hook for initialization logic onpagechanged() hook for page change handling no tracking code all custom analytics/tracking functionality removed as specified step 6 verify migration check that the migrated file includes ✅ complete purpleanalyticsreadmode class from readmode loader js ✅ your custom configuration variables ✅ your custom functions (ui manipulation, image handling, etc ) ✅ proper hook integration for initialization and page changes ❌ no custom tracking or analytics code ❌ no modifications to the core readmode loader js code step 7 deploy migrated file review the custom migrated js file to ensure it meets your requirements replace your existing custom js file with the migrated version cp custom migrated js /custom js test the integration in your application migration architecture before (legacy) // custom tracking code mixed with ui code let timetracker = new timetracker(); // direct event handling swiperslidechanged = function(swiper, articles) { // custom logic + tracking mixed together }; after (migrated) // clean separation using hooks purpleanalyticsreadmode oninitialized = function() { // custom initialization logic only }; purpleanalyticsreadmode onpagechanged = function(article, index) { // custom page change logic only (no tracking) }; troubleshooting common issues "files not found" error ensure you're running claude from within the migration folder incomplete migration verify both source files are present in the migration folder core code modified the migration should never modify readmode loader js code, only add custom code in the designated section file structure check your migration folder should contain migration/ ├── custom js (original) ├── readmode loader js (new base) └── custom migrated js (generated output) support if you encounter issues during migration ensure all files are in the migration folder run claude from within the migration folder verify the instruction text matches exactly as provided check that both source files are readable and contain the expected content the migration process preserves all your custom functionality while integrating it into the new purple analytics readmode architecture without any tracking components