How can I add an event-specific pixel for Linkedin tracking on button click in Webflow without leading users to another URL for success?
TL;DR
- Log into LinkedIn Campaign Manager to get your tracking code.
- Add LinkedIn Insight Tag to Webflow's
<head>tag in Project Settings. - Use Element Settings to add an Embed element near the button.
- Write a JavaScript snippet with button click event, replacing IDs with your specific LinkedIn data.
- Publish and test to ensure the event fires correctly.
You want to track a button click as a Linkedin event using a pixel in Webflow without redirecting users. Here's how:
1. Prepare Your LinkedIn Tracking Code
- Log into your LinkedIn Campaign Manager to access your tracking code.
- Find your Insight Tag and note any specific details or event codes that you’ll need to implement.
2. Add Custom Code in Webflow
- Go to Project Settings in Webflow for the site where you want to add the tracking.
- Navigate to the Custom Code section and locate the Inside
<head>tag area. - Paste your LinkedIn Insight Tag here if it’s not already added globally. This ensures the page can recognize the LinkedIn tracking when an event is triggered.
3. Add a Custom Code Embed to the Page or Element
- In the Webflow Designer, select the element (button) you want to track.
- Use the Element Settings (D) to add an Embed element near or around the button if not directly supported.
4. Implement the OnClick Event
- Within the Embed element, write a small JavaScript snippet to track the button click:
- Example code:
```javascript
<script>
document.getElementById('buttonID').onclick = function() {
// LinkedIn tracking call
linkedinpartnerid = "yourpartner_id";
window.lintrk('track', { conversionid: 'yourconversion_id', value: 0 });
};
</script>
```
- Replace
buttonIDwith your actual button ID from Webflow (found in the element settings). - Customize
yourpartneridandyourconversionidwith the IDs specific to your LinkedIn Insight Tag.
5. Publish and Test
- Publish your site to check if the tracking works.
- Use browser tools or LinkedIn’s event manager to confirm the event fires correctly on button click.
Summary
To add a LinkedIn event-specific pixel on a button click in Webflow, prepare your LinkedIn tracking code, add it to your site's custom head code, implement a custom onclick JavaScript snippet for the button, and finally test the setup. This allows you to track events without redirecting users.