Kling 2.1: China’s Best Video Generation Model Yet

K.C. Sabreena Basheer Last Updated : 25 Jul, 2025
6 min read

Marking the 1st anniversary of the Chinese video generation tool, Kling AI, its parent company, Kuaishou, has launched their most advanced model yet – Kling 2.1. After the success of Kling 1.6 and 2.0, users and creators have been waiting for the release of Kling AI’s next big thing, and it’s finally here. With advanced video generation capabilities and better coherence and rendering skills, Kling 2.1 stands as a formidable contender in the AI video generation arena against proprietary models such as Google’s Veo 3 and OpenAI’s Sora. In this article, we’ll explore the features and video generation capabilities of Kling 2.1 and see how well it performs against Veo 3.

What Is Kling 2.1?

Kling 2.1 is an advanced AI-powered video generation model developed by Kuaishou. It transforms reference images and text prompts into high-definition, cinematic videos, leveraging sophisticated technologies like 3D spatiotemporal attention mechanisms and diffusion transformer architectures. Designed to simulate real-world physics and intricate motion dynamics, Kling 2.1 aims to deliver videos that are both visually stunning and contextually coherent. Building upon its predecessor, Kling 2.0, this latest iteration introduces enhancements that cater to both beginners as well as seasoned professionals.

Features of Kling 2.1

Here are some of the key features of Kling 2.1:

  1. Frame-based Video Generation: As opposed to most video generation models that focus on text-to-video generation, Kling 2.1 generates videos based on input images as reference frames.
  2. Realistic Motion and Physics Simulation: Utilizing a 3D spatiotemporal joint attention mechanism, Kling 2.1 accurately models complex movements, ensuring that generated videos adhere to the laws of physics and exhibit natural motion.
  3. Dynamic Facial Expressions: The model excels in generating life-like facial expressions and accurate movements, enhancing the realism of characters and making them more engaging.
  4. Multiple Video Options: Kling 2.1 offers creating multiple videos from the same prompt, giving users more freedom and choice, without the need for multiple iterations.
  5. AI-powered Prompting: For those who find it difficult to write detailed and accurate prompts for video generation, the model offers a DeepSeek-powered AI tool for generating prompts.

Also Read: 10 Amazing Video Generation Tools You Need to Check Out Today!

How to Access Kling 2.1

Kling 2.1 and its Master version are both available on the Kling AI website and app. Users around the world can sign up with just an email ID, and try out the models directly for image-to-video generation, using the free credits given during sign up. Note that these models can only be used for image-to-video generation, as of now.

How to Use Kling 2.1

Here’s how you can generate videos from images using Kling 2.1 and Kling 2.1 Master:

  1. Select the Model on Kling AI

    Once you open the website, select Kling 2.1 (or Kling 2.1 Master) from the model selection drop-down menu on top.
    Kling 2.1 model selection

  2. Upload Reference Images

    Under the image-to-video tab, select ‘Frames’ and upload a reference image to be used as the starting frame or end frame of the generated video. Please note that the Elements feature is currently not supported by Kline 2.1.
    Kling 2.1 video generation

  3. Add a Prompt

    You have the option of adding a prompt to describe the video or a negative prompt explaining what you would not want in the video. You can even use DeepSeek to generate detailed prompts for you based on your description, theme, or thought.

  4. Configure the Properties

    Once you have the reference image and prompts (optional) in place, choose if you want a standard or professional (for VIP users) video. Then decide on the length of the video (5 or 10 seconds) and the number of outputs you would like to generate (upto 4). Please note that only VIP users have the option of generating multiple videos from a single image/prompt.

  5. Generate the Video

    Now that you’re all set, simply click on ‘Generate’ and wait in line for the model to generate your video. In the free version, this might take up to 120 minutes.

  6. Generate Sound (optional)

    Once the video is generated, Kling gives you the option of adding sound to it using their sound generation tool. You can add your prompt here and generate 4 different sounds and dialogues to match the scene. However, please note that the tool only generates audio in Chinese for now and does not automatically lip sync with the video.
    Kling 2.1 audio generation

Video Generation Capabilities of Kling 2.1

Users have taken to social media, praising Kling 2.1’s ability to produce videos with realistic motion and expressive characters. Let’s check out a few of the videos generated by Kling 2.1 from different image prompts, to see how good this tool really is.

1. Hyper-realistic Human Video

Input Image:

Kling 2.1 image

Prompt: “A woman is dancing to fast-paced music.”

Output:

Source: Kling AI Library

2. Animated Gaming Video

Input Image:

Kling 2.1 image

Description: “car in the city racing, 4K ultra realistic high-octane chase. Smooth movement, photorealistic, high quality.”

DeepSeek-generated Prompt: “A sleek hover-car weaving between towering holographic billboards, blue plasma thrusters igniting, cityscape reflecting off its chrome body, 4K ultr­a realistic, dynamic motion”

Output:

Source: Kling AI Library

3. Dynamic Action Video

Input Image:

Kling 2.1 image

Prompt: “Cinematic action shot in the style of an action movie with a drone racing through a forest woodland at noon, navigating between trees. Sunlight streaking through leaves, close front follow angle, dynamic movement, high contrast, intense atmosphere, detailed composition.”

Negative Prompt: “morphing, erratic fluctuation in motion, noisy, bad quality, distorted, poorly drawn, blurry, grainy, low resolution, oversaturated, lack of detail, inconsistent lighting. Wrong anatomy, unnatural facial expressions, unnatural movements, blur, warp, distortion, disfigurement, pixelation, noisy, grainy, overly bright colors, harsh shadows, oversaturated colors, erratic fluctuation, artefacts, glitch, low quality, bad face, transition, morphing, titles, texts, logos, Cartoonish features.”

Output:

Source: Kling AI Library

Kling 2.1 vs Veo 3 vs Sora: Features Comparison

Speaking of advanced video generation, we must find out how good this free tool is as compared to proprietary models like Google’s Veo 3 and OpenAI’s Sora. Here’s a standard comparison of the features of all three video generation models.

FeatureKling 2.1Veo 3Sora
Max Video Length3 minutes1 minute1 minute
Resolution1080p1080p1080p
Lip-Sync CapabilityNoYesNo
Physics SimulationYesYesNo
Aspect Ratio FlexibilityLowModerateLow
Editing ToolsBasicBasicBasic
Access AvailabilityGlobal (Beta)Limited (US only)Limited

Kling 2.1 vs Veo 3: Performance Comparison

Now, let’s compare the performance of the two models we currently have access to: Kling 2.1 and Veo 3.

Here’s a video I found online, which was generated using Veo 3.

I’ll use a screenshot of this video as the first frame reference image, add a prompt describing the scene, and see what Kling 2.1 does with it.

Input Image:

Kling 2.1 image

Prompt: “An American man wearing a blue t-shirt is at the boarding counter at the airport with his pet penguin. The airline staff, lady dressed in blue, does not let him take the penguin on board. He’s frustrated as she tries to explain the situation to him.”

Video Generated by Kling 2.1

Now let’s use Kling 2.1 to add audio to the generated video.

Comparative Analysis

Veo 3 generated a very realistic video with great detailing, appropriate expressions, and very well lip-synced audio. Even the flow of the movement and the clarity and tone of the dialogues were top notch. On the whole, this is one of the best AI tools I’ve ever come across for video generation.

Kling 2.1 is exceptionally good at recreating videos from reference frames, as seen above. It generated pretty realistic people and animals with accurate expressions and details. As a free tool, it does a better job than most others. However, when it comes to generating audio and syncing it, Kling 2.1 is rather disappointing. Be it the tone or the timing, it simply doesn’t align with the video. So that’s something I think the tool still needs to work on.

Conclusion

Kling 2.1 proves to be a promising model in the AI-powered video generation landscape. Its easy-to-use interface, quality of creating coherent videos, and ability to add audio to it, make it one of the best free-to-use AI video generators out there. Its capabilities in realistic motion simulation, facial expression rendering, and creative artistry take it a step ahead of most of its contemporaries. That being said, the model still has room for improvement when it comes to generating audio and accurately lip syncing. So, here’s looking forward to Kling AI’s next version that’ll probably fix these issues as well.

Sabreena is a GenAI enthusiast and tech editor who's passionate about documenting the latest advancements that shape the world. She's currently exploring the world of AI and Data Science as the Manager of Content & Growth at Analytics Vidhya.

Login to continue reading and enjoy expert-curated content.

Responses From Readers

Clear

NotebookLM basics and setup • Research and insights with AI • Create content and workflows
`); const learning_path_mode = document.querySelector('#learning-path-mode'); learning_path_mode?.addEventListener('click',(event)=>{ mixpanel.track("LearningPathClicked",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, "current_url":current_interactive_url, "wp_article_id": "236721", "element_text":'Download Now', "element_type":'Button', "mode": learning_path_mode && learning_path_mode.classList.contains('active')?'active':'normal', "learning_path":is_learning_path }); }) let learning_goal_option = false, learning_goal_month_option = false let learningpath_option = 'Generalized Learning Path'; const PersonalisedForm = document.getElementById('PersonalisedForm') document.querySelector('#PersonalisedCreateNowBtn')?.addEventListener('click',(e)=>{ learningpath_option = 'Personalized Learning Path'; mixpanel.track("PathChosen ",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, "current_url":current_interactive_url, "wp_article_id": "236721", "element_text":document.querySelector('#PersonalisedCreateNowBtn').innerText, "element_type":'Button', "mode": learning_path_mode && learning_path_mode.classList.contains('active')?'active':'normal', "learningpath_option": learningpath_option, "learning_path":is_learning_path }); PersonalisedForm.classList.add('active') document.querySelectorAll('#GeneralisedForm,#Personalised').forEach((item)=>{ item.style.display = "none"; }) }) const learning_goal = document.querySelectorAll('#PersonalisedForm .form-check-input'); let learningGoal let learningTime learning_goal.forEach((item)=>{ item.addEventListener('click',(e)=>{ if(e.target.name == 'answer'){ learningGoal = e.target.nextElementSibling.innerText PersonalisedForm.querySelector('button').setAttribute('data-goal',e.target.getAttribute('data-id')) learning_goal_option = parseInt(e.target.value) } else { PersonalisedForm.querySelector('button').setAttribute('data-time',e.target.getAttribute('data-id')) learningTime = e.target.nextElementSibling.innerText learning_goal_month_option = parseInt(e.target.value) } if(learning_goal_option !== false && learning_goal_month_option !== false){ PersonalisedForm.querySelector('button').removeAttribute('disabled') } }) }) document.querySelectorAll('#personalisedlearningPath button[type=submit]').forEach((item,index)=>{ item.addEventListener('click',(event)=>{ event.preventDefault() //let learningpath_option = index?'Personalised Learning Path':'Generalised Learning Path' mixpanel.track("LearningPathDownloaded ",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, "current_url":current_interactive_url, "wp_article_id": "236721", "mode": learning_path_mode && learning_path_mode.classList.contains('active')?'active':'normal', "learningpath_option": learningpath_option, "card_number": index + 1, "element_text":item.innerText, "element_type":'Button', "learning_path":is_learning_path }); if(index){ mixpanel.track("PersonalisedLearningPath ",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, "current_url":current_interactive_url, "wp_article_id": "236721", "mode": learning_path_mode && learning_path_mode.classList.contains('active')?'active':'normal', "learningpath_option": learningpath_option, "card_number": index + 1, "goal":learningGoal, "time":learningTime, "element_text":item.innerText, "element_type":'Button', "learning_path":is_learning_path }); } else { mixpanel.track("PathChosen ",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, "current_url":current_interactive_url, "wp_article_id": "236721", "mode": learning_path_mode && learning_path_mode.classList.contains('active')?'active':'normal', "learningpath_option": learningpath_option, "element_text":item.innerText, "element_type":'Button', "learning_path":is_learning_path }); } learningpath_option = 'Generalized Learning Path'; //if($('#userName').attr("data-email")){ fetch("https://yukti.analyticsvidhya.com/api/save-user-preference/", { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ "email": $('#userName').attr("data-email")?$('#userName').attr("data-email"):'Guest user', "goal": event.target.getAttribute('data-goal'), "timeframe": event.target.getAttribute('data-time') }) }) .then((response) => response.text()) .then((result) => { result = JSON.parse(result) window.open(result.roadmap_link, '_blank'); if(PersonalisedForm.classList.contains('active')) PersonalisedForm.classList.remove('active') $('#personalisedlearningPath').modal('hide'); document.querySelectorAll('#GeneralisedForm,#Personalised').forEach((item)=>{ item.style.display = "block"; }) }) .catch((error) => console.error(error)); // } else { // screen_name = 'Personlized Learning Path' // $('#loginModal').modal('show'); // } }) }) personalisedlearningPath.querySelector('.modal-header button').addEventListener('click',()=>{ mixpanel.track("LearningPathClosed ",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, "current_url":current_interactive_url, "wp_article_id": "236721", "mode": learning_path_mode && learning_path_mode.classList.contains('active')?'active':'normal', "card_number": PersonalisedForm.classList.contains('active')?2:1, "element_text":"", "element_type":'Icon', "learning_path":is_learning_path }); document.querySelectorAll('#GeneralisedForm,#Personalised').forEach((item)=>{ item.style.display = "block"; }) if(PersonalisedForm.classList.contains('active')) PersonalisedForm.classList.remove('active') }) } // have or not interactive mode else { // else for intra\ mode is_interactive = true; $("#article-start > p:nth-of-type(3)").after(`
New Feature Beta
🎲 Make This Article Fun and Interactive with Flash Cards and Quizzes!
`); // interactive slider setTimeout(function(){ var swiper = new Swiper(".mySwiperMode", { pagination: { el: ".swiper-pagination", type: "progressbar", }, navigation: { prevEl: "#mySwiperModePrevBtn", nextEl: "#mySwiperModeNextBtn", }, }); },2000) let card_body = document.querySelector('#interactivemodeRight .card-body.overflow-auto'); let myOffcanvas = document.getElementById('interactivemodeRight') if(document.querySelectorAll('#interactivemodeRight .col-lg-6.col-sm-12 a')){ document.querySelectorAll('#interactivemodeRight .col-lg-6.col-sm-12 a').forEach((item,index)=>{ item.onclick = ()=>{ mixpanel.track('InterativeModeRecommendedClicked', { "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'current_url': current_interactive_url, "wp_article_id": "236721", "recommended_wp_article_id": item.attr('data-recommended'), "recommended_article_pos": (index == 0 || index == 1?1:2), "element_text":item.innerText, "element_type":(index == 0 || index == 2?'Image':'Text'), "interactive_mode" : true }); } }) } // when interactive card opened let startInteractiveTime = ""; myOffcanvas.addEventListener('shown.bs.offcanvas', function (event) { startInteractiveTime = new Date().getTime(); let mode = $('#interactive-mode').hasClass('active'); let tags = $('.mySwiperMode .swiper-slide.swiper-slide-active').attr('data-tags'); let version = $('.mySwiperMode .swiper-slide.swiper-slide-active').attr('data-version'); let created_date = $('.mySwiperMode .swiper-slide.swiper-slide-active').attr('data-created-date'); mixpanel.track('InteractiveModeCardView', { "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'current_url': current_interactive_url, "wp_article_id": "236721", "card_number": 1, "card_type": $('.mySwiperMode .swiper-slide.swiper-slide-active h3').html(), "tags" : (tags?tags.split(","):''), "json_version" : version, "created_date" : created_date, "interactive_mode" : true }); mixpanel.track('IneractiveModeClicked', { "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, "element_text":document.querySelector('#interactive-mode button').innerText, "element_type":'Button', 'current_url': current_interactive_url, "wp_article_id": "236721", "mode" : (mode?'active':'normal'), "tags" : (tags?tags.split(","):''), "json_version" : version, "created_date" : created_date, "interactive_mode" : true }); }) // when interactive card closed myOffcanvas.addEventListener('hidden.bs.offcanvas', function () { var endInteractiveTime = new Date().getTime(); var timeSpent = (endInteractiveTime - startInteractiveTime)/1000; let tags = $('.mySwiperMode .swiper-slide.swiper-slide-active').attr('data-tags'); let version = $('.mySwiperMode .swiper-slide.swiper-slide-active').attr('data-version'); let created_date = $('.mySwiperMode .swiper-slide.swiper-slide-active').attr('data-created-date'); mixpanel.track('InteractiveModeTimeSpent', { "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'current_url': current_interactive_url, "wp_article_id": "236721", "time_spent_secs": timeSpent, "card_type": $('.mySwiperMode .swiper-slide.swiper-slide-active h3').html(), "card_number": $('.mySwiperMode .swiper-slide.swiper-slide-active').attr('data-slide'), "tags" : (tags?tags.split(","):''), "json_version" : version, "created_date" : created_date, "interactive_mode" : true }); mixpanel.track('InteractiveModeClosed', { "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'current_url': current_interactive_url, "wp_article_id": "236721", "card_number": $('.mySwiperMode .swiper-slide.swiper-slide-active').attr('data-slide'), "card_type": $('.mySwiperMode .swiper-slide.swiper-slide-active h3').html(), "tags" : (tags?tags.split(","):''), "json_version" : version, "created_date" : created_date, "interactive_mode" : true, "element_text":'', "element_type":'Icon' }); }) let slide_count = 1; let nextbtn = document.getElementById('mySwiperModeNextBtn'); let prevbtn = document.getElementById('mySwiperModePrevBtn'); //previous button clicked prevbtn.onclick = ()=>{ if(card_body){ card_body.scrollTo({ top: 0, behavior: 'smooth' }); } $('#interactivemodeRight .alert.alert-success').addClass('d-none'); $('#interactivemodeRight .alert.alert-warning').addClass('d-none'); let tags = $('.mySwiperMode .swiper-slide.swiper-slide-active').attr('data-tags'); let version = $('.mySwiperMode .swiper-slide.swiper-slide-active').attr('data-version'); let created_date = $('.mySwiperMode .swiper-slide.swiper-slide-active').attr('data-created-date'); mixpanel.track('InteractivemodeButtonPressed', { "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'current_url': current_interactive_url, "wp_article_id": "236721", "card_number": $('.mySwiperMode .swiper-slide.swiper-slide-active').attr('data-slide'), "button_type": "Previous", "tags" : (tags?tags.split(","):''), "json_version" : version, "created_date" : created_date, "interactive_mode" : true, "element_text":prevbtn.innerText, "element_type":'Button' }); slide_count--; } //next button clicked nextbtn.onclick = ()=>{ if(card_body){ card_body.scrollTo({ top: 0, behavior: 'smooth' }); } slide_count++; $('#interactivemodeRight .alert.alert-success').addClass('d-none'); $('#interactivemodeRight .alert.alert-warning').addClass('d-none'); let slide = document.querySelector('.mySwiperMode .swiper-slide.swiper-slide-active'); if(slide){ let tags = $('.mySwiperMode .swiper-slide.swiper-slide-active').attr('data-tags'); let version = $('.mySwiperMode .swiper-slide.swiper-slide-active').attr('data-version'); let created_date = $('.mySwiperMode .swiper-slide.swiper-slide-active').attr('data-created-date'); let slide_no = $('.mySwiperMode .swiper-slide.swiper-slide-active').attr('data-slide'); mixpanel.track('InteractivemodeButtonPressed', { "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'current_url': current_interactive_url, "wp_article_id": "236721", "card_number": slide_no, "button_type": "Next", "tags" : (tags?tags.split(","):''), "json_version" : version, "created_date" : created_date, "interactive_mode" : true, "element_text":prevbtn.innerText, "element_type":'Button' }); mixpanel.track('InteractiveModeCardView', { "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'current_url': current_interactive_url, "wp_article_id": "236721", "card_number": slide_count, "card_type": $('.mySwiperMode .swiper-slide.swiper-slide-active h3').html(), "tags" : (tags?tags.split(","):''), "json_version" : version, "created_date" : created_date, "interactive_mode" : true, }); } } let najus = [{ "With Emoji": "🎯 Spot on! You got it right.", "Without Emoji": "Spot on! You got it right!" }, { "With Emoji": "Well done! 👍 That's the correct answer.", "Without Emoji": "Well done! That's the correct answer!" }, { "With Emoji": "Correct! You're on a roll. 🚀", "Without Emoji": "Correct! You're on a roll!" }, { "With Emoji": "👏 Nice work! That's the right choice.", "Without Emoji": "Nice work! That's the right choice." }, { "With Emoji": "You nailed it! Great job! ✨", "Without Emoji": "You nailed it! Great job!" }, { "With Emoji": "✅ Exactly! You’re absolutely correct.", "Without Emoji": "Exactly! You’re absolutely correct." }, { "With Emoji": "Perfect! You know your stuff. 💡", "Without Emoji": "Perfect! You know your stuff." }, { "With Emoji": "Great answer! Keep it up! 💪", "Without Emoji": "Great answer! Keep it up!" }, { "With Emoji": "Yes, that's right! Well played. 🏆", "Without Emoji": "Yes, that's right! Well played." }, { "With Emoji": "🌟 That's correct! You're doing great.", "Without Emoji": "That's correct! You're doing great." }, { "With Emoji": "Right on! 🏅 You're acing this.", "Without Emoji": "Right on! You're acing this!" }, { "With Emoji": "Correct answer! Fantastic effort. 🎉", "Without Emoji": "Correct answer! Fantastic effort." }, { "With Emoji": "You got it! 🏃\u200d♂️ Keep going!", "Without Emoji": "You got it! Keep going!" }, { "With Emoji": "Well guessed! 🐀𣀠You picked the right one.", "Without Emoji": "Well guessed! You picked the right one." }, { "With Emoji": "🔥 Bang on! That's the correct answer.", "Without Emoji": "Bang on! That's the correct answer." }, { "With Emoji": "Absolutely right! Well done! 🙌", "Without Emoji": "Absolutely right! Well done!" }, { "With Emoji": "Right answer! 🚀 You’re unstoppable.", "Without Emoji": "Right answer! You’re unstoppable." }, { "With Emoji": "You’ve got it! 🧠 Great understanding.", "Without Emoji": "You’ve got it! Great understanding." }, { "With Emoji": "👏 Correct choice! That’s impressive.", "Without Emoji": "Correct choice! That’s impressive." }, { "With Emoji": "Nice! You made the right call. ✅", "Without Emoji": "Nice! You made the right call." }, { "With Emoji": "Spotless! 🎯 That’s exactly right.", "Without Emoji": "Spotless! That’s exactly right." }, { "With Emoji": "Well spotted! 👀 You answered correctly.", "Without Emoji": "Well spotted! You answered correctly." }, { "With Emoji": "Good job! You’re absolutely correct. 💯", "Without Emoji": "Good job! You’re absolutely correct." }, { "With Emoji": "🎊 Yes, you got it! Great work.", "Without Emoji": "Yes, you got it! Great work." }, { "With Emoji": "🏆 That's the answer! Nicely done.", "Without Emoji": "That's the answer! Nicely done." }, { "With Emoji": "You’ve hit the mark! 🎯 That’s correct.", "Without Emoji": "You’ve hit the mark! That’s correct." }, { "With Emoji": "Perfectly answered! Keep it up. 🏆", "Without Emoji": "Perfectly answered! Keep it up." }, { "With Emoji": "You’ve aced it! Well answered. 🌟", "Without Emoji": "You’ve aced it! Well answered." }, { "With Emoji": "🔥 Right choice! You’re on fire.", "Without Emoji": "Right choice! You’re on fire." }, { "With Emoji": "Correct! You’re getting better and better. 📈", "Without Emoji": "Correct! You’re getting better and better." }, { "With Emoji": "🏆 That’s it! You’re absolutely right.", "Without Emoji": "That’s it! You’re absolutely right." }, { "With Emoji": "Great thinking! 🧠 Correct answer.", "Without Emoji": "Great thinking! Correct answer." }, { "With Emoji": "🎉 Yes! That’s the right one.", "Without Emoji": "Yes! That’s the right one." }, { "With Emoji": "👌 Spot-on choice! Well chosen.", "Without Emoji": "Spot-on choice! Well chosen." }, { "With Emoji": "Well done! 🏆 That’s the way to go.", "Without Emoji": "Well done! That’s the way to go." }, { "With Emoji": "Correct! 🎓 You’ve mastered this.", "Without Emoji": "Correct! You’ve mastered this." }, { "With Emoji": "Smart choice! Correct answer. 🧠", "Without Emoji": "Smart choice! Correct answer." }, { "With Emoji": "🌟 Yes, indeed! That’s correct.", "Without Emoji": "Yes, indeed! That’s correct." }, { "With Emoji": "Well chosen! 🎯 That’s the right answer.", "Without Emoji": "Well chosen! That’s the right answer." }, { "With Emoji": "You’ve got it! Brilliant answer. 🏆", "Without Emoji": "You’ve got it! Brilliant answer." }, { "With Emoji": "Correct! 🏃\u200d♀️ You’re getting the hang of this.", "Without Emoji": "Correct! You’re getting the hang of this." }, { "With Emoji": "Well done! 🔓 You’ve cracked it.", "Without Emoji": "Well done! You’ve cracked it." }, { "With Emoji": "✨ Absolutely right! Keep shining.", "Without Emoji": "Absolutely right! Keep shining." }, { "With Emoji": "🎉 You did it! That’s correct.", "Without Emoji": "You did it! That’s correct." }, { "With Emoji": "Great job! 🎯 You’re spot on.", "Without Emoji": "Great job! You’re spot on." }, { "With Emoji": "Bingo! 🎯 You got the right answer.", "Without Emoji": "Bingo! You got the right answer." }, { "With Emoji": "Yes, you’re correct! Nice work. 👍", "Without Emoji": "Yes, you’re correct! Nice work." }, { "With Emoji": "Right on target! 🎯 Well done.", "Without Emoji": "Right on target! Well done." }, { "With Emoji": "💪 Correct! That’s the spirit.", "Without Emoji": "Correct! That’s the spirit." }, ]; $('.mySwiperMode .swiper-slide .option-group .form-check-input').change(function(e){ let user_email = $('#userName').attr("data-email"); let slide_no = $('.mySwiperMode .swiper-slide.swiper-slide-active').attr('data-slide'); let tags = $('.mySwiperMode .swiper-slide.swiper-slide-active').attr('data-tags'); let version = $('.mySwiperMode .swiper-slide.swiper-slide-active').attr('data-version'); let created_date = $('.mySwiperMode .swiper-slide.swiper-slide-active').attr('data-created-date'); let question = $('.mySwiperMode .swiper-slide.swiper-slide-active h2').html(); let user_answer = $(this).val(); let correct_answer = $('.mySwiperMode .swiper-slide.swiper-slide-active .option-group').attr('data-answer'); let is_correct = false; let article_version_id = myOffcanvas.getAttribute('data-article-version-id'); // console.log(article_version_id); if(user_answer == correct_answer){ let randomInt = Math.floor(Math.random() * (najus.length - 0 + 1)) + 0; is_correct = true; $('#interactivemodeRight .alert.alert-success').html(` ${najus[randomInt]['With Emoji']}`) $('#interactivemodeRight .alert.alert-success').removeClass('d-none'); $('#interactivemodeRight .alert.alert-warning').addClass('d-none'); } else { let hint = $('.mySwiperMode .swiper-slide.swiper-slide-active .option-group').attr('data-hint'); $('#interactivemodeRight .alert.alert-warning').html(` ${hint}`); $('#interactivemodeRight .alert.alert-warning').removeClass('d-none'); $('#interactivemodeRight .alert.alert-success').addClass('d-none'); } mixpanel.track('InteractiveModeAnswerGiven', { "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'current_url': current_interactive_url, "wp_article_id": "236721", "card_number": slide_no, "answer_given": user_answer, "correct" : is_correct, "tags" : (tags?tags.split(","):''), "json_version" : version, "created_date" : created_date, "interactive_mode" : true, "element_text":e.target.nextElementSibling.innerText, "element_type":'Option' }); if(user_email){ $.ajax({ url: "https://www.analyticsvidhya.com/wp-content/themes/analytics-vidhya/send-user-interaction-response.php", method: "POST", data: {user_email:user_email,is_correct:is_correct,question:question,user_answer:user_answer,correct_answer:correct_answer,slide_no:slide_no,article_version_id:article_version_id}, success: function(result){ // console.log(result); } }); } }); } } }) }).catch((err)=>{ console.log(err); }) // All Other Clicks document.querySelectorAll('a').forEach(anchor => { anchor.addEventListener('click', function(e) { if (other_clicks == 0){ dataLayer.push({ event : 'datalayer_click', "blog_id" : "236721","blog_page_visit" : "https://www.analyticsvidhya.com/blog/2025/06/kling-2-1/" , "blog_user_id" : uid ,"blog_user_email" : uemail ,"blog_user_full_name" : ufullname,"blog_user_preferred_name" : upname , "blog_link_click_anchor_text": e.innerHTML, "blog_link_click_href": $(this).attr('href')}); } else other_clicks = 0; }); }); // User Login Data Layer function datalayer_user_login() { dataLayer.push({ event : 'datalayer_click', "user_logged_in": "true","blog_page_visit" : "https://www.analyticsvidhya.com/blog/2025/06/kling-2-1/" ,"blog_user_id" : uid ,"blog_user_email" : uemail ,"blog_user_full_name" : ufullname,"blog_user_preferred_name" : upname,"blog_utm_source" : '', "blog_utm_medium" : '' , "blog_utm_campaign" : ''}); } //added script after footer setTimeout(()=>{ //moment js //google api js let element = document.createElement('script') element.setAttribute("src", "https://apis.google.com/js/api:client.js"); footer.insertAdjacentElement("afterend", element); //popper js element = document.createElement('script') element.setAttribute("src", "https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js"); element.setAttribute("integrity", "sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r"); element.setAttribute("crossorigin", "anonymous"); element.setAttribute("async", "true"); footer.insertAdjacentElement("afterend", element); //bootstrap js element = document.createElement('script') element.setAttribute("src", "https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.min.js"); element.setAttribute("integrity", "sha384-BBtl+eGJRgqQAUMxJ7pMwbEyER4l1g+O15P+16Ep7Q9Q+zqX6gSbd85u4mG4QzX+"); element.setAttribute("crossorigin", "anonymous"); element.setAttribute("async", "true"); footer.insertAdjacentElement("afterend", element); //font awesome element = document.createElement('link') element.setAttribute("src", "https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap"); element.setAttribute("rel", "stylesheet"); document.head.appendChild(element); // add new design of TOC var main = document.querySelector('.yoast-table-of-contents'); if(main){ var head = main.querySelector('h2'); var next = head.nextElementSibling; var acrd = '

    '+next.innerHTML+'
'; main.innerHTML = acrd; } document.querySelector('#accordionContent button').addEventListener('click',function(e){ if(e.target.classList.contains('collapsed')) document.querySelector('.yoast-table-of-contents').style.height = 'auto' else document.querySelector('.yoast-table-of-contents').style.height = '400px' }) },1000); setTimeout(() => { //WriteforUsClicked Event document.querySelectorAll('#writeUs .row a').forEach(link => { events.forEach(eventType => { link.addEventListener(eventType, function(event) { let link_text = document.querySelector('#writeUs h2').innerText mixpanel.track("WriteforUsClicked",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'element_text':link_text, 'element_type':'Text', 'link_url':link.getAttribute('href'), "current_url":current_interactive_url }); }); }); }); //TopContributorsClicked Event document.querySelectorAll('#writeUs .author-items a').forEach(link => { events.forEach(eventType => { link.addEventListener(eventType, function(event) { let link_text = link.querySelector('.author-text p').innerText mixpanel.track("TopContributorsClicked",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'link_text':link_text, 'link_url':link.getAttribute('href'), "current_url":current_interactive_url }); }); }) }); // Write for us now var swiper = new Swiper(".write-author", { lazy: true, rewind: true, autoplay: { delay: 2500, disableOnInteraction: false, }, breakpoints: { "@0.00": { slidesPerView: 1.5, spaceBetween: 10, }, "@0.75": { slidesPerView: 2, spaceBetween: 20, }, "@1.00": { slidesPerView: 3, spaceBetween: 40, }, "@1.50": { slidesPerView: 4, spaceBetween: 50, }, }, }); // Category Slider for Navbar var swiper = new Swiper(".category-header-items", { //spaceBetween: 30, slidesPerView: "auto", loop: true, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, }); const userPreference = localStorage.getItem('theme'); const body = document.body; const logoImage = document.getElementById('logoImage'); if (userPreference === 'dark') { body.classList.add('dark-mode') document.querySelectorAll('.author-title').forEach(item => { item.classList.add('text-white') }) logoImage.setAttribute('src', 'https://www.analyticsvidhya.com/wp-content/themes/analytics-vidhya/icon/AV_logo_wite.png'); //console.log("dark") } else { body.classList.add('light-mode') } // Toggle theme on button click document.querySelector('li[name=theme-mode]')?.addEventListener('click', function(e) { let mode if (body.classList.contains('light-mode')){ mode = "Dark Mode" body.classList.remove('light-mode'); body.classList.add('dark-mode'); }else{ mode = "Light Mode" body.classList.remove('dark-mode'); body.classList.add('light-mode'); } //SwitchModeClicked event mixpanel.track("SwitchModeClicked",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'current_mode':mode, 'element_type': 'Button', 'element_text':e.target.innerText, "current_url":current_interactive_url, }); // Change logo source based on the selected theme if (body.classList.contains('dark-mode')) { document.querySelectorAll('.author-title').forEach(item => { item.classList.add('text-white') }) logoImage.setAttribute('src', 'https://www.analyticsvidhya.com/wp-content/themes/analytics-vidhya/icon/AV_logo_wite.png'); } else { logoImage.setAttribute('src', 'https://www.analyticsvidhya.com/wp-content/themes/analytics-vidhya/icon/av-logo-svg.svg'); } // Save user preference to localStorage const currentTheme = body.classList.contains('dark-mode') ? 'dark' : 'light'; localStorage.setItem('theme', currentTheme); }); // add bordered on table $('.categroy-page table').addClass('table table-bordered'); //CategoriesClicked Event const categories_list = document.querySelectorAll('.is_category'); categories_list.forEach((item,index)=>{ events.forEach(eventType => { item.addEventListener(eventType, function(event){ mixpanel.track("CategoriesClicked",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'element_type': 'Link', "element_text":item.innerText, "link_url":event.target.href, "current_url":current_interactive_url }); }) }); }) // FaqClicked Event setTimeout(()=>{ document.querySelectorAll('#accordionFaq .accordion-item button').forEach((button,index) => { button.addEventListener('click', function(event) { let status = (button.classList.contains('collapsed')?'closed':'opened') mixpanel.track("FaqClicked",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'status':status, 'item_number':index+1, "current_url":current_interactive_url, "element_text" : button.innerText, 'element_type': 'Icon', }); }); }); },2000) // sticky category bar window.addEventListener('scroll', function() { var scrollPosition = window.scrollY document.querySelectorAll('header').forEach(item => { if (scrollPosition >= 200) item.classList.add('active'); else item.classList.remove('active'); }) /* document.querySelectorAll('.category-bar-header').forEach(item => { if (scrollPosition >= 200) item.classList.add('active'); else item.classList.remove('active'); }) */ var windowHeight = window.outerHeight; var documentHeight = document.documentElement.offsetHeight; var offsetHeight = document.getElementById('article-start').offsetHeight; var readingProgress = document.getElementById('reading-progress'); if (scrollPosition >= 300) { var progress = (scrollPosition - 300) / (offsetHeight - windowHeight) * 100; progress = Math.min(100, Math.max(0, progress)); readingProgress.style.width = progress + '%' if (scrollPosition + windowHeight === offsetHeight) { readingProgress.style.width = '100%' } } else { readingProgress.style.width = '0'; } }); //copy button let code_lm = document.getElementsByClassName("wp-block-code") if(code_lm){ hljs.highlightAll(); Array.from(code_lm).forEach((item)=>{ item.innerHTML += '' }) } var faq_question = ''; var faq_answer = ''; var id = ''; var new_faq_content = ''; $('.schema-faq-section').each(function(index,element){ id = $(element).attr('id'); faq_question = $(element).find(' .schema-faq-question strong').html(); faq_answer = $(element).find(' .schema-faq-answer').html(); faq_question = (typeof(faq_question) === "undefined"?$(element).find(' .schema-faq-question').html():faq_question); new_faq_content += '

'+faq_answer+'

'; }); if(new_faq_content != ''){ new_faq_content = `

Frequently Asked Questions

${new_faq_content}
`; document.getElementById('writeUs').insertAdjacentHTML("beforebegin", new_faq_content); const last_toc = document.querySelector('.yoast-table-of-contents ol > li:last-child a'); if(last_toc.getAttribute('href') == '#h-frequently-asked-questions'){ last_toc.setAttribute('href','#faq'); } } if(document.getElementById('h-frequently-asked-questions')){ $('#h-frequently-asked-questions ~ .wp-block-yoast-faq-block').remove(); document.getElementById('h-frequently-asked-questions').remove(); } document.querySelectorAll('.logged-in-as').forEach(item=>item.remove()); // copy code button document.querySelectorAll('.copy-button').forEach((button,index) => { button.addEventListener('click', function() { const code = this.previousElementSibling.innerText; //CopycodeClicked mixpanel.track("CopycodeClicked",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, "element_text":code, "element_type":'Text', "item_number": index + 1, "current_url":current_interactive_url }); navigator.clipboard.writeText(code).then(() => { const originalText = this.innerText; this.innerText = "Copied!"; setTimeout(() => { this.innerText = originalText; }, 2000); // Reset after 2 seconds }).catch(err => { console.error("Could not copy text: ", err); }); }); }); var comment = document.getElementById('comment'); var clear_text_btn = document.querySelector('.clear-text-btn'); //for comments reply id $('.comment-parent').click(function(){ var comment_id = $(this).data('commentid'); $(this).next('div').find('.form-submit input#comment_parent').val(comment_id); }); if(clear_text_btn){ clear_text_btn.addEventListener('click', function(e) { //comment.value = ""; }) } //show clear commets button if(comment){ comment.addEventListener('keyup', function(e){ if(e.target.value.length >0){ document.querySelector('.clear-text-btn').classList.remove('d-none') }else{ document.querySelector('.clear-text-btn').classList.add('d-none') } }) } let commentform = document.getElementById('commentform'); if(commentform){ commentform.onsubmit = function(){ if(comment){ if(comment.value){ localStorage.setItem("wait_approval",1); } } } } let getLocalStorage = localStorage.getItem("wait_approval"); if(getLocalStorage == 1){ localStorage.removeItem("wait_approval"); document.getElementById('respond').insertAdjacentHTML('beforebegin',"

Your comment is awaiting moderation.

"); } $("#viewAllCommentsBtn").on("click", function(){ $("#viewAllComments").find("#commentsLoader").removeClass('d-none'); $.ajax({ url: "https://www.analyticsvidhya.com/wp-admin/admin-ajax.php", type: 'POST', data: { action: 'view_all_comments', post_id: 236721 }, success:function(res){ res = res.slice(0,-1); if(res != ''){ $(".comment-list").append(res); $("#viewAllComments").addClass("d-none"); setupCommentFieldClickListener(); }else{ //console.log("No More Comments."); } } }) }) //TOCClicked Event ======= setTimeout(()=>{ const toc_list = document.querySelectorAll('.wp-block-yoast-seo-table-of-contents .accordion-body a'); toc_list.forEach((item,index)=>{ item.addEventListener('click', function(event){ mixpanel.track("TOCClicked",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, "element_text":item.innerText, "link_url":item.getAttribute('href'), "item_number": index + 1, "element_type":'List', "current_url":current_interactive_url }); }) }) //TOCblockClicked document.querySelector('.wp-block-yoast-seo-table-of-contents .accordion-header button')?.addEventListener('click',(event)=>{ mixpanel.track("TOCblockClicked",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, "element_type":'Icon', "element_text":event.target.innerText, "current_url":current_interactive_url, "toc_state": event.target.classList.contains('collapsed')?'closed':'opened' }); }) },1000) //FreeCoursesClicked Event const free_courses_list = document.querySelectorAll('.free-courses-card-row a'); free_courses_list.forEach((item,index)=>{ events.forEach(eventType => { item.addEventListener(eventType, function(event){ const text = item.querySelector('h4'); mixpanel.track("FreeCoursesClicked",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'element_type':'Link', "element_text":text.innerText, "link_url":item.getAttribute('href'), "current_url":current_interactive_url }); }) }) }) // AuthorProfileClicked Event on detail page document.querySelectorAll('.detail-page .author-card.d-flex a').forEach((link,index) => { events.forEach(eventType => { link.addEventListener(eventType, function(event) { let link_text = link.innerText if(!link_text){ link_text = link.parentElement.nextElementSibling.firstElementChild.innerText } mixpanel.track("AuthorProfileClicked",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'element_text':link_text, 'element_type':'Link', 'link_url':link.getAttribute('href'), "current_url":current_interactive_url, "item_number": index == 0 || index == 1?1:2 }); }); }); }); //InterlinkClicked Event document.querySelectorAll('.detail-page #article-start a').forEach((item,index)=>{ events.forEach(eventType => { item.addEventListener(eventType, function(event){ mixpanel.track("InterlinkClicked",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, "element_text":item.innerText, 'element_type':'text', "link_url":item.getAttribute('href'), "current_url":current_interactive_url }); }) }) }) setTimeout(function(){ // track page view mixpanel.track('PageView', { "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, "current_url": window.location.href, "referrer_url": document.referrer, "interactive_mode" : is_interactive, "learning_path": is_learning_path }); },1000) },1500); // Mixpanel Events Here ----------------------------------------------------------------------------------------------------------------------------- //FlashstripClicked Event document.getElementById('avFlashSale')?.addEventListener('click', function(event) { const aTag = event.target.closest("a") let link_url = aTag.href; let link_text = aTag.children["hrefId"].innerText; mixpanel.track("FlashstripClicked",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'element_type':'Button', 'element_text':link_text, 'link_url':link_url, "current_url":current_interactive_url }); }); //AvlogoClicked Event events.forEach(eventType => { document.querySelector('header .navbar-brand')?.addEventListener(eventType, function(event) { const link_url = document.querySelector('header .navbar-brand').getAttribute('href'); if(link_url){ mixpanel.track("AvlogoClicked",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'element_type':'Logo', 'element_text':'', "link_url":link_url, "current_url":current_interactive_url }); } }); }); //WriteBlogClicked Event events.forEach(eventType => { document.getElementById('writeHeaderBtn')?.addEventListener(eventType, function(event) { mixpanel.track("WriteBlogClicked",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'element_type':'Icon', 'element_text':'', "current_url":current_interactive_url }); }); }) //SearchButtonClicked Event events.forEach(eventType => { document.getElementById('searchHeaderBtn')?.addEventListener(eventType, function(event) { mixpanel.track("SearchButtonClicked",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'element_type':'Icon', 'element_text':'', "current_url":current_interactive_url }); }); }); //CategoryClicked Event document.querySelectorAll('.category-bar-header a').forEach((item,index)=>{ events.forEach(eventType => { item.addEventListener(eventType, function(event){ mixpanel.track("CategoryClicked",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, "element_text":item.innerText, 'element_type':'text', "link_url":item.getAttribute('href'), "current_url":current_interactive_url }); }) }); }) //SocialMediaIconClicked Event document.querySelectorAll('.bottom-footer > a.icon-wrapper').forEach((item,index)=>{ events.forEach(eventType => { item.addEventListener(eventType, function(event){ const text = item.getAttribute('aria-label'); mixpanel.track("SocialMediaIconClicked",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, "element_text":"", "element_type":"Icon", "link_url":item.getAttribute('href'), "current_url":current_interactive_url, "item_type":text }); }) }) }) //TnCClicked Event document.querySelectorAll('.bottom-footer p a').forEach((item,index)=>{ events.forEach(eventType => { item.addEventListener(eventType, function(event){ mixpanel.track("TnCClicked",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, "element_text":item.innerText, 'element_type': 'Text', "link_url":item.getAttribute('href'), "current_url":current_interactive_url }); }) }); }) //NavbarClicked Event document.querySelectorAll('#offcanvasNavbar2 .navbar-nav li a').forEach(link => { events.forEach(eventType => { link.addEventListener(eventType, function(event) { mixpanel.track("NavbarClicked",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'element_text':link.innerText, 'element_type':'text', 'link_url':link.getAttribute('href'), "current_url":current_interactive_url }); }); }) }); // FooterClicked Event document.querySelectorAll('footer .row a, #seoFooter a').forEach(link => { events.forEach(eventType => { link.addEventListener(eventType, function(event) { let perent = event.target.closest('div'); let item_type = perent.getElementsByTagName("h2")[0].innerText; mixpanel.track("FooterClicked",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'element_text':link.innerText, 'element_type':'Text', 'link_url':link.getAttribute('href'), "current_url":current_interactive_url, "item_type":item_type }); }); }); }); // AuthorProfileClicked Event document.querySelectorAll('.container .card-footer.border-0 > a').forEach(link => { events.forEach(eventType => { link.addEventListener(eventType, function(event) { mixpanel.track("AuthorProfileClicked",{ "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'link_text':link.innerText, 'link_url':link.getAttribute('href'), "current_url":current_interactive_url, "item_number": "Not Set" }); }); }); }); // LoginClicked Event document.querySelectorAll('.loginModalBtn').forEach(element => { element.addEventListener('click', function(e) { if(loginOpen){ mixpanel.track('LoginClicked', { "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'current_url': current_interactive_url, 'login_screen_name': (login_screen_name?login_screen_name:'Navbar') }); loginOpen = false } }); }); // SkipbuttonClicked Event document.querySelector('#loginModal .modal-header button')?.addEventListener('click', function (event) { mixpanel.track('SkipbuttonClicked', { "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'current_url': current_interactive_url, 'login_screen_name': (login_screen_name?login_screen_name:'Navbar'), 'link_url': '', 'element_text': event.target.innerText, 'element_type':'Button', 'modal_name': modal_name }); login_screen_name = '' loginOpen = true }) // Signup Event document.getElementById('email-login-btn')?.addEventListener('click', function (event) { mixpanel.track('Signup', { "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'current_url': current_interactive_url, 'login_screen_name': (login_screen_name?login_screen_name:'Navbar'), 'link_url': '', 'element_text': event.target.innerText, 'element_type':'Button', 'modal_name': modal_name, 'signup_mode': 'Email' }); }) // ReceiveupdatesClicked Event document.getElementById('isWhatsappLoginModal')?.addEventListener('click', function (event) { mixpanel.track('ReceiveupdatesClicked', { "Platform":'Blogs', "Is_Logged_In":is_logged_in, "screen_name":screen_name, 'current_url': current_interactive_url, 'login_screen_name': (login_screen_name?login_screen_name:'Navbar'), 'link_url': '', 'element_text': '', 'element_type':'Checkbox', 'modal_name': modal_name, 'receive_updates': event.target.checked }); }) // console.log("Home page") if(!localStorage.getItem("aiPopup")){ // console.log(`Country : ${data.country_name} (${data.country})`) const today = new Date(); const day = today.getDate(); const month = today.toLocaleString('default', { month: 'long' }); // e.g., "June" const year = today.getFullYear(); const formattedDate = `${day}-${month}-${year}||`; // pinneple plus var popupData = { country:"Other", heading:"Witness the rise of the Agentic Operating Layer", subheading:"Four days that will reshape your AI career", points: `
  • 12+ workshops: Build AI solutions under expert guidance
  • 45+ hack sessions: Real engineering problems, solved on stage
  • 75+ AI talks: Real case studies and industry insights 
  • `, form:{ heading:"DataHack Summit 2026", cta:"Download Brochure", skip_btn:"I don't want to upskill ", }, form_submit:{ url:"https://www.analyticsvidhya.com/datahacksummit/api/create/leads/", headers: { 'Authorization': 'Token 72335f0d073f0b14a589dc46cba6bb7407dfda8d', 'Content-Type': 'application/json', 'Referer': window.location.href, }, body:{ form_type:"brochure", fullname:"", email: "", phone:"", whatsapp_optin: true, utm_source: "blog", utm_medium: "desktop_popup", utm_campaign: formattedDate, utm_term: "", utm_content: "brochure", gcl_id: "", page_url: current_interactive_url, country_code:"" } } } document.querySelector('footer').insertAdjacentHTML('afterend',` `); setTimeout(() => { $("#generativeAiModal input[type=tel]").intlTelInput({ allowDropdown: true, autoHideDialCode: true, initialCountry:"IN", preferredCountries: ["in","us" ], }); if(is_logged_in){ window.$("#imageAiModal").modal("show"); } document.querySelector('#generativeAiModal button.btn-dark-primary').addEventListener('click',(e)=>{ e.preventDefault(); const leadEmail = document.getElementById('leadEmail'); const leadPhoneNumber = document.getElementById('leadPhoneNumber'); const leadEmailError = document.getElementById('leadEmailError'); const leadPhoneNumberError = document.getElementById('leadPhoneNumberError'); let isError = 0; if(leadEmail.value.trim() == ""){ isError = 1; leadEmailError.innerText = "Email is required."; leadEmailError.classList.remove('d-none'); }else if(!isValidEmail(leadEmail.value)){ isError = 1; leadEmailError.innerText = "Invalid email."; leadEmailError.classList.remove('d-none'); } if(leadPhoneNumber.value.trim() == ""){ isError = 1; leadPhoneNumberError.innerText = "Mobile Number is required."; leadPhoneNumberError.classList.remove('d-none'); }else if(leadPhoneNumber.value.length != 10){ isError = 1; leadPhoneNumberError.innerText = "Invaild Mobile Nomber."; leadPhoneNumberError.classList.remove('d-none'); } if(isError == 0){ let body = ""; if(popupData.country == "IN"){ popupData.form_submit.body.email = leadEmail.value; popupData.form_submit.body.phone = leadPhoneNumber.value; popupData.form_submit.body.whatsapp_optin = document.getElementById('isWhatsappGenAiModal').checked?true:false; body = JSON.stringify(popupData.form_submit.body); }else{ popupData.form_submit.body.email = leadEmail.value; popupData.form_submit.body.phone = leadPhoneNumber.value; popupData.form_submit.body.whatsapp_optin = document.getElementById('isWhatsappGenAiModal').checked?true:false; popupData.form_submit.body.country_code = $("#generativeAiModal .iti__selected-flag").attr("title").split(":")[1].trim(); body = JSON.stringify(popupData.form_submit.body); } getCSRF1().then((csrfToken)=>{ popupData.form_submit.headers["X-CSRFToken"]= csrfToken; fetch(popupData.form_submit.url, { method: 'POST', headers: popupData.form_submit.headers, body: body }) .then((response) => response.text()) .then((result) => { // console.log("result : ", result) result = JSON.parse(result) if((result.id) || (result.response && result.response.status_code && (result.response.status_code == 201 || result.response.status_code == 200))){ e.target.insertAdjacentHTML('afterEnd','

    Details on the way! Check Your Inbox

    ') localStorage.setItem('aiPopup',1); setTimeout(()=>{ bootstrap.Modal.getInstance(document.querySelector('#imageAiModal')).hide(); },3000) } }) .catch((error) => console.error(error)); }); } }); // Phone number validation --- document.getElementById("leadPhoneNumber")?.addEventListener("keypress", function(e) { const charCode = e.which || e.keyCode; if (charCode !== 8 && charCode !== 0 && (charCode 57)) { e.preventDefault(); }else if(e.target.value.length >= 10){ e.preventDefault(); } }); document.getElementById("leadPhoneNumber")?.addEventListener("keyup", function(e) { if(e.target.value.length == 10 && !leadPhoneNumberError.classList.contains('d-none')){ leadPhoneNumberError.classList.add('d-none') } }) document.getElementById("leadEmail")?.addEventListener("keyup", function(e) { if(!leadEmailError.classList.contains('d-none')){ if(isValidEmail(e.target.value)){ leadEmailError.classList.add('d-none') } } }) // when user press skip btn document.getElementById("skipAiPop")?.addEventListener("keypress", function(e) { const today = new Date(); const dmy = today.toLocaleDateString("en-GB").replace(/\//g, "-"); localStorage.setItem("aiPopupDate",dmy); }) }, 18000); // 18000 } console.log("version:1.0");