Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use programmatically? #31

Closed
elvismdev opened this issue Jan 7, 2023 · 4 comments · Fixed by #34
Closed

How to use programmatically? #31

elvismdev opened this issue Jan 7, 2023 · 4 comments · Fixed by #34
Assignees
Labels
new-feature Request for a new feature

Comments

@elvismdev
Copy link

Let's say I have a simple form with an input field where I would insert an Amazon product URL https://www.amazon.com/dp/B01MRZFBBH

On form submit, I would like this Amazon product URL to turn into https://www.amazon.com/dp/B01MRZFBBH?tag=us-tag and display below the form to the end user to copy.

How can I accomplish that with this library?

@russellsteadman russellsteadman self-assigned this Jan 8, 2023
@russellsteadman russellsteadman added the new-feature Request for a new feature label Jan 8, 2023
@russellsteadman
Copy link
Owner

Hi Elvis! The way affiliate is currently configured, it cannot be used to directly update the link on form submit. Instead, it would update an anchor link (i.e. <a href="...">...</a>). See the documentation for an example of this.

There should be a text-based link affiliation method such as instance.convertLink('...'), and I will add that in version 5.0.0 when released.

@elvismdev
Copy link
Author

@russellsteadman That'd be great! An instance.convertLink('...') method would be a great addition to this library.

In the meanwhile I'll see what I can do playing with the current implementation. Maybe I can print the <a> tag and then right after update or manipulate the DOM.

@russellsteadman russellsteadman linked a pull request Jan 8, 2023 that will close this issue
@russellsteadman
Copy link
Owner

@elvismdev This will be implemented as aff.convert('https://www.example.com/') in the next major release. I plan to push out a major release within the next week.

@elvismdev
Copy link
Author

@russellsteadman This looks great! I'll look forward to the next release, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature Request for a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants