-
-
Notifications
You must be signed in to change notification settings - Fork 3
Use Case: Different Styles for Social Media
Ever wanted to give visitors from Instagram a slightly different vibe on your site compared to those coming from LinkedIn? Good news: you can! By using UTM parameters (those handy tags you add to URLs), you can detect where your visitors are coming from and dynamically change how parts of your website look and feel. This means a more tailored, engaging experience that can make a real difference to your conversion rates.
Imagine you're running promotions across Instagram, Facebook, and LinkedIn. Each platform has its own unique audience and aesthetic. Wouldn't it be great if the landing page or specific sections on your site could visually align with the platform the user just left?
- Instagram visitor? Maybe they see a more visual, image-heavy section.
- Facebook visitor? Perhaps a section that encourages community or sharing.
- LinkedIn visitor? They might appreciate a more professional, information-focused layout.
This isn't about creating entirely different websites, but about smart, subtle customizations that make users feel right at home.
The magic happens by checking the utm_source
parameter in the URL. If you tag your social media links correctly, you can use this information to apply specific CSS classes to sections of your page.
Here’s how you might structure your links:
-
Instagram Link:
https://www.yourwebsite.com/your-page?utm_source=instagram&utm_campaign=spring_promo
-
Facebook Link:
https://www.yourwebsite.com/your-page?utm_source=facebook&utm_campaign=spring_promo
-
LinkedIn Link:
https://www.yourwebsite.com/your-page?utm_source=linkedin&utm_campaign=spring_promo
Then, in your website's template or code, you can check for these utm_source
values. The example below uses Blade (a templating engine for Laravel, a PHP framework), but the concept applies to other backend languages or even JavaScript on the client-side.
{{-- Example using Blade's @class directive --}}
<section @class([
'section-base-styles', // Always apply these base styles
'instagram-section-theme' => hasUtm('source', 'instagram'),
'facebook-section-theme' => hasUtm('source', 'facebook'),
'linkedin-section-theme' => hasUtm('source', 'linkedin'),
'default-section-theme' => !hasUtm('source', ['instagram', 'facebook', 'linkedin']) // Fallback
])>
<h2>Welcome, Social Media Visitor!</h2>
<p>This content might look slightly different based on where you came from.</p>
{{-- More content for the section --}}
</section>
Breaking it down:
-
section-base-styles
: This CSS class would apply your standard styling for this type of section. -
instagram-section-theme
: Ifutm_source
isinstagram
, this class is added. You'd then define.instagram-section-theme
in your CSS to apply Instagram-specific styles (e.g., different background color, font, image treatment). - Similar logic applies for
facebook-section-theme
andlinkedin-section-theme
. -
default-section-theme
: This is a fallback if theutm_source
isn't one of the specified social platforms, ensuring your section still looks good. - The
hasUtm('source', 'instagram')
is a hypothetical helper function. In a real-world scenario, you'd implement logic to parse the URL's query parameters (e.g., usingrequest()->query('utm_source')
in Laravel, orURLSearchParams
in JavaScript).
In your CSS, you'd have something like:
.section-base-styles {
padding: 20px;
border: 1px solid #ccc;
margin-bottom: 20px;
}
.instagram-section-theme {
background-color: #f0f2f5; /* Light, airy feel */
border-left: 5px solid #C13584; /* Instagram-ish accent */
}
.facebook-section-theme {
background-color: #e9ebee;
border-left: 5px solid #1877F2; /* Facebook blue */
}
.linkedin-section-theme {
background-color: #f3f2ef;
border-left: 5px solid #0A66C2; /* LinkedIn blue */
}
.default-section-theme {
background-color: #fff; /* Standard background */
}
This way, the same HTML section gets a different visual treatment based on the utm_source
.
Customizing sections of your site based on the social media referral source isn't just a neat trick; it can seriously pay off:
- Boosted Engagement: A familiar aesthetic or tailored messaging can make users feel more comfortable and understood, encouraging them to stick around and interact more.
- Higher Conversion Rates: When the user journey from social media to your site feels seamless and relevant, users are more likely to take the desired action (e.g., sign up, make a purchase).
- Stronger Brand Cohesion: It shows attention to detail and creates a more polished, cohesive experience across different touchpoints.
By tailoring content and design, you're speaking more directly to different audience segments, and that usually leads to better results. Give it a try!