Any way to set a ID on a button?

I usually have an ID for my buttons, and this way I can track the button clicks in Google Analytics using events.

But, I can’t find a way to add an ID to the buttons in Sparkle.

Is this possible?

@WebRoyal, If you mean a Div id then yes. I use it to introduce bespoke CSS for my projects.

If you go to Settings/Miscellaneous/Code Integration, tick it and then hit done. Now go to your canvas and click on the button you want to track and go to top right Arrange/Code Integration… and that should do it.

Maybe you can enlighten us on this “events” technique with Google Analytics - I wasn’t aware of it but it sounds it could be very useful.
Thanks.

2 Likes

Yes Sparkle can do that. When you enable “Allow HTML element id customization” in the Miscellaneous site settings, you get a “Code integration” section of the arrange inspector of all elements, and in the case of buttons where the id goes depends on the button type.

For buttons with a custom look it’s going to be in the a tag:

<a href="https://sparkleapp.com" id="mybutton" class="f btn v3 s3">Button</a>

For buttons with a system look it’s on the input tag:

<input id="mybutton" type="submit" value="Button" name="button" class="js s3 submit">

3 Likes

I’ll make a video about how I use this to track events in Google, @greenskin. Thanks!

4 Likes

Thanks @duncan - love it. This program gets better every time I ask a question. :wink: